I am working on data fetched from API call and want to hide the section where there is no data being fetched.Please help with a sample code of the same.
CodePudding user response:
I would suggest taking a look at the ngIf directive. This will display the content when the condition is met. You would then need the condition to evaluate to false when the API call is empty, and true when it's not.
CodePudding user response:
this.http.get<any>("api").subscribe((res:any)=>{
if(!res){ return false}