Hey there! I'm looking for some advice on how to display a loading indicator like this:
https://i.sstatic.net/7luvR.gif
while waiting for my Firebase data to load completely.
I attempted to use
<div *ngIf="!listOfFoodObject">
<img [src]="https://i.sstatic.net/7luvR.gif" />
</div>
but unfortunately, it didn't work as expected. Can anyone assist me with this?
This is the current Firebase code in my controller:
firebase.database().ref('menu_name').orderByChild('menu_name').once('value',(snapshot)=>{
snapshot.forEach((snap)=>{
this.listOfFoodObject.push({
key: snap.key,
menu_name:String(snap.val().menu_name).toUpperCase(),
menu_image:snap.val().menu_image,
description:snap.val().description
});
return false;
});
});
And here's my <ion-list>
view:
<ion-list>
<ion-item *ngFor="let food of listOfFoodObject">
<ion-thumbnail item-left (click)="show_item_details(food.menu_name,food.key,food.menu_image,food.description)">
<img src="{{food.menu_image}}">
</ion-thumbnail>
<h2 (click)="show_item_details(food.menu_name,food.key,food.menu_image,food.description)">{{food.menu_name}}</h2>
<p (click)="show_item_details(food.menu_name,food.key,food.menu_image,food.description)">{{food.description}}</p>
<p>
<ion-icon ios="ios-star" md="md-star"></ion-icon>
3.8
</p>
<button ion-button round item-right (click)="show_item_details(food.menu_name,food.key,food.menu_image,food.description)">View sellers</button>
</ion-item>
</ion-list>
Thanks for any help you can provide!