In my Angular project where I get data from API and display on frontend. I am using ngIf to display data, if no data is available then elseNotDone
is displayed.
The problem I am facing is when component reloads, I first see No Data available
for few milliseconds and then data is displayed
How can I make sure else condition is not displayed on initial render?
<section *ngIf="data!== undefined && data.length > 0; else elseNotDone">
<h2>Amazon Data</h2>
<div>
// display data from API
</div>
</section>
<ng-template #elseNotDone>
No Data available
</ng-template>