In my Ionic 5 app, I am displaying a LoadingController like so:
async presentLoading() {
const loading = await this.loadingCtrl.create({
message: 'Please wait...',
});
await loading.present();
}
getPosts() {
this.presentLoading();
query.get()
.then((docs) => {
docs.forEach((doc) => {
this.posts.push(doc);
})
this.cursor = this.posts[this.posts.length - 1];
}).catch((err) => {
console.log(err)
})
}
Once this.posts
is populated, I want the LoadingController to be dismissed.
Can someone please tell me how to do this? Thanks a lot in advance!