Hi,
I am using LoadingController from ‘ionic-angular’ to show loading while loading data from the server and inserting to the table as can be seen in the following piece of code:
getData() {
let loading = this.loadCtrl.create({
content: 'Downloading randomisation packs.....'
});
loading.present().then(() => {
this.http.get(this.serverLink).map(res => res.json()).subscribe(data => {
for (let obj of data) {
this.insertTo_Randomisation_list(obj.ID, obj.Rx, obj.Rand_ID);
}
})
}).then(() => {
loading.dismiss();
})
}
I want the loading to be present while the data is inserting in the table. However, loading.dismiss() is called early and the loading disappears. I need to fix this as soon as possible. any help or suggestion would be appreciated.
Thanks in Advance.