hello all i have i ion-tabs page as a root page ,
and in my app.component.ts
a i register a backbuttonAction for showing alert for the user to confirm the app exit,
this is my code for showing alert
this.platform.registerBackButtonAction(() => {
if (this.alertShown == false && !this.nav.canGoBack()) {
this.presentConfirm();
} else if (this.alertShown == false) {
this.nav.pop();
}
});
presentConfirm() {
let alert = this.alertCtrl.create({
title: 'تأكيد الخروج',
message: 'انت علي وشك الخروج من التطبيق ,هل تريد ذالك ؟',
buttons: [
{
text: 'الغاء',
role: 'cancel',
handler: () => {
console.log('Cancel clicked');
this.alertShown = false;
}
},
{
text: 'نعم اريد',
handler: () => {
console.log('Yes clicked');
this.platform.exitApp();
}
}
]
});
alert.present().then(() => {
this.alertShown = true;
});
}
my problem here is that can go back always return false , any help please ?
thanks in advance