I need a way to tell the user that content is being fetched and after the content has been fetched the loader to disappear
Easiest way is to use a property in the controller, then use an *ngIf
in the view:
Controller
export class Page {
this.loading = false;
this.loadMore(){
this.loading = true;
service.loadMore().then(() => this.loading = false);
}
}
View
<ion-content>
<div *ngIf="loading">Loading...</div>
<div *ngIf=!loading"> ... </div>
<ion-content>
I would argue even simpler than the previous advice would be to use the Ionic LoadingController.
2 Likes
What I do instead, is fake loading progression by putting in “empty state” styles…kind of like how Facebook and Google do. They’ll populate an item or two but fill them with squares where content will be.