I encountered an issue while using alert messages in my login menu:
Runtime Error Uncaught (in promise): false Stack Error: Uncaught (in promise): false
Here is the code snippet causing the problem:
public login() {
this.showLoading()
this.auth.login(this.Login).subscribe(allowed => {
if (allowed) {
//this.navCtrl.setRoot('Inicio');
this.usuarioLogueado = this.auth.getUserInfo();
if(this.usuarioLogueado.tipo == "Administrador"){
this.navCtrl.setRoot(Administrador);
}
console.log("Welcome",this.usuarioLogueado.usuario,this.usuarioLogueado.tipo);
} else {
this.showError("Access denied");
}
},
error => {
this.showError(error);
});
}
showLoading() {
this.loading = this.loadingCtrl.create({
content: 'Please wait...',
dismissOnPageChange: true
});
this.loading.present().then(() => this.loading.dismiss());
}
showError(text) {
this.loading.dismiss().catch(() => console.log('ERROR: Loading control failed'));
let alert = this.alertCtrl.create({
title: 'Failure',
subTitle: text,
buttons: ['OK']
});
alert.present(prompt);
}
}