Current page on registerBackButtonAction


I have a sidemenu app with subpages. I use this.navCtrl.push(MySubPage)

I used registerBackButtonAction() on app.components.ts to permit an user friendly navigation.

How I can get the info on the current page istance? I’d like to show an alert message depending of the state of the current page.


I found solution for my requirements: I used ionViewCanLeave on specific view:

ionViewCanLeave(): Promise<void> {
  return new Promise((resolve, reject) => {
   if (!myConditionExit){

    let confirm = this.alertCtrl.create({
      title: 'Exit',
      message: 'There are changes not saved',
      buttons: [{
        text: 'OK',
        handler: () => {
      }, {
        text: 'Cancel',
        handler: () => {