Ion-back-button does nothing

So I went into the ionic source code and found out that the back buttons onClick method is just checking if there is a routerOutlet and if it can go back, and decided to log those things out. All looks good, canGoBack is true, so the back button should then execute this.routerOutlet.pop() (https://github.com/ionic-team/ionic-framework/blob/f58424f62596b9eb82bebb8e07c211e1725c025a/angular/src/directives/navigation/ion-back-button.ts).

But, for reasons unknown I guess it isn’t. So, I just added a method to my profile component that calls the pop directly:

  goBack() {
    this.routerOutlet.pop();
  }

And just tossed it on the back button:

<ion-back-button (click)="goBack()"></ion-back-button>

Now, I still think it’s dumb that I have to do this, since the back button should be doing it automatically, but at least I get the back animation now.

Would still like to know how to avoid this tho, if anyone has any idea.

2 Likes