Ionic 2 Beta 11: loading.dismiss() does not work with other overlays
Since Beta 11 I have this issue:
let loading = this.loadingCtrl.create({content: 'Loading...'});
loading.present();
this.geolocationService.geolocate().subscribe(
(data) => {
loading.dismiss();
let alert = this.alertCtrl.create({
title: 'Title',
subTitle: 'Text',
buttons: ['OK']
});
alert.present();
},
...
);
loading.dismiss() does not have any effect, the loading overlay stays open. loading.destroy() removes it but I guess that is not the way to go.
I'm also using ionic 2 beta 11 , loading.dismiss() works fine..
Hello, thanks for opening am issue with us! Would you mind posting a repo I can use to reproduce this issue? Thanks for using Ionic!
Hmm.... some time ago I've have similar issue - not sure if it is Your problem. loading.dismiss() returns promise - try do something like:
loading.dismiss().then(() => {
... (place here code you do after dismiss)
});
especially when You want to open modal - it may causes some kind of lock f.e.:
WRONG
loading.dismiss();
modal.present(); // Loading is not fully closed!! may cause lock!!!
Works
loading.dismiss().then(()=>
modal.present();
)
For me, loading component works really unstable, it cause locks (f.e. #7948), so I've resigned to use it. I hope it helps...
I agree - this seems to be working fine for me now. But I have a problem with <ion-select>s when using a modal as described here: https://github.com/driftyco/ionic/issues/7839.
Thank you @borys, I forgot to mention the alert I opened after the loading.dismiss() (edited). Your solution fixed it for me. I would consider it being a bug still.
Hello @tbmk I'm glad @borys was able to help you with your issue! So, this is not actually a bug but simply how our asynchronous navigation works in Ionic 2. You cannot have two transitions going on at the same time, which is why our nav methods return promises to let you know when a transition is done. Thanks for using Ionic!
Hmm @jgw96