Error after dismissing loading


#1

Facing this issue in 3.0.1: If the loading is dismissed then following error is thrown:

Uncaught (in promise): false
    at g (polyfills.js:3)
    at l (polyfills.js:3)
    at l (polyfills.js:3)
    at polyfills.js:3
    at t.invokeTask (polyfills.js:3)
    at Object.onInvokeTask (core.es5.js:4136)
    at t.invokeTask (polyfills.js:3)
    at n.runTask (polyfills.js:3)
    at a (polyfills.js:3)

Code:

let loading = loadingController.create({
    spinner : 'hide',
    content : `Loading`
});
loading.present();
//Do some work
loading.dismiss().then(() => {
    //Exit work
});

#2

You could try:

loading.onDidDismiss(() => {
   //Exit work
});
loading.present();
//Do some work
loading.dismiss();

#3

Any Luck with this error I also seem to be getting same error in 3.0.1 code was working fine before update


#4
content : `Loading`

it seems like you used backticks insteads of normal quotes. Is that on purpose?


#5

One thing you can try doing is:

loading.present()
  .then(() => doSomeWork())
  .then(() => loading.dismiss());

Also see framework #11119.


#6

Thanks @rapropos my issue was an async method and hitting the loading.dismiss without completing the async method (similar to the link you posted). Changing the position of the loading.dismiss(); to the code block after completion of async method solved the issue for me.