I have a app with ionic 4 beta 19.
I use ion-back-button in app’s header.
I use NavControl for navigate between pages.
I init back button hardware in app.component.ts with below code:
this.platform.backButton.subscribeWithPriority(9999999, () => {
const routerOutlet = this.routerOutlets.first;
this.menuCtrl.isOpen().then((res) => {
if (res) {
this.menuCtrl.close();
return;
} else if (this.alertService.isOpen()) {
this.alertService.closeAlert();
return;
}
if (this.router.url === ('/' + AppGlobal.PAGE_LIST.OFFLINE) || this.router.url === ('/' + AppGlobal.PAGE_LIST.REQUEST_SURVEY)) {
return;
} else if ((this.router.url === ('/' + AppGlobal.PAGE_LIST.LOGIN)) || (this.router.url === ('/' + AppGlobal.PAGE_LIST.HOME))) {
this.alertService.showConfirm('EXIT', '', 'DO_YOU_WANT_TO_EXIT?', undefined, undefined, () => {
navigator['app'].exitApp();
});
} else if (routerOutlet && routerOutlet.canGoBack()) {
this.navCtrl.goBack();
}
});
});
but the pages break out when use back button hardware(android) together with ion-back-button in header.
how to resolve this problem ?