Page animation for "back" event?

Let’s say I am transitioning from Page1 to Page2. In Page1, I used,

this.navCtrl.push(Page2, {}, {animate:true, animation:'forward'});

to make Page2 slide in from right. But in Page2, if I press the Android back button, it does not show the slide animation. How can I make Page2 slide out to the right when the back button is pressed?

And put whatever transition into the nav.pop options.

I had seen that, and I customised the behaviour of the back arrow on the toolbar. So the animation works when I go back with the toolbar, but NOT when I press the Android back button (on the bottom of the screen). How can I show animation when press the system back button, not the back arrow on the toolbar?


Thank you, I could achieve the effect I wanted. But it still feels like a hack. I wish Ionic would have provided a way to set the exit animation in the navCtrl directly.

How to “unregister” the back button action? I cannot find any such method.

Overriding the back button seems to be global within the app, not confined in the page, so it seems doing this on a few pages breaks the back button and the app does not exit when the back button is pressed.


For future people.