ionViewWillEnter() {
let loading = loadingCtrl.create({
content: 'Espere...'
});
loading.present();
this.accountProvider.currentAccount()
.then(account => {
//do somethings
loading.dismiss(); <-- Uncaught (in promise): false
});
}
ionViewWillEnter() {
let loading = loadingCtrl.create({
content: 'Espere...'
});
loading.present();
this.accountProvider.currentAccount()
.then(account => {
//do somethings
setTimeout(() => {
loading.dismiss();
}, 0); <-- work fine
});
}
It’s a bug?
Regards!
You have oversimplified the problem away, I think. You don’t provide AccountService
, so I mocked its currentAccount()
method like so:
currentAccount(): Promise<any> {
return Promise.resolve({foo: 'bar'});
}
…and threw your code into the HomePage
of a stock tabs project, and it worked just fine.
Hi @rapropos
Thx for your answer.
again…
ionic poc blank --v2
put this code into home.ts and it’ll failed
import { Component } from '@angular/core';
import { NavController, LoadingController } from 'ionic-angular';
@Component({
selector: 'page-home',
templateUrl: 'home.html'
})
export class HomePage {
constructor(
public navCtrl: NavController,
public loadingCtrl: LoadingController) {
}
ionViewWillEnter() {
let loading = this.loadingCtrl.create({
content: 'Espere...'
});
loading.present();
this.currentAccount()
.then(data => {
loading.dismiss();
/*setTimeout(() => {
loading.dismiss();
}, 0);*/
});
}
currentAccount(): Promise<any> {
return Promise.resolve({ foo: 'bar' });
}
}
It did not fail. It worked as expected.

ionic info
Your system information:
cordova CLI: 6.5.0
Ionic CLI Version: 2.2.2
Ionic App Lib Version: 2.2.1
ios-deploy version: Not installed
ios-sim version: Not installed
OS: Windows 10
Node Version: v6.10.2
Xcode version: Not installed

@rapropos what is your ionic info?
@rapropos yesssss it works!!!
thanks you!!
Thank you for being persistent and nailing down that it might be version related. I made a new scratch project and was able to reproduce. Filed a PR to warn about this in the docs.