我使用警報消息我登錄菜單時,有下列錯誤:未捕獲的(在承諾):假
Runtime Error Uncaught (in promise): false Stack Error: Uncaught (in promise): false
這是代碼:
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("bienvenido",this.usuarioLogueado.usuario,this.usuarioLogueado.tipo);
} else {
this.showError("Acceso denegado");
}
},
error => {
this.showError(error);
});
}
showLoading() {
this.loading = this.loadingCtrl.create({
content: 'Por favor espere...',
dismissOnPageChange: true
});
this.loading.present().then(() => this.loading.dismiss());
}
showError(text) {
this.loading.dismiss().catch(() => console.log('ERROR: Control de loading fallo'));
let alert = this.alertCtrl.create({
title: 'Fallo',
subTitle: text,
buttons: ['OK']
});
alert.present(prompt);
}
}
請將您的代碼添加到您的問題。鏈接到您的代碼的圖片是不合適的。 – mrogers
原因是該頁面稍後可能不存在,並且具有相同問題的下一個人將無法看到您的代碼。 –
我添加了代碼。 –