Catch software back button ionic 3

I need to catch ionic back button for specific page and redirect user to different page.

Use Case:

Page A -> Page B -> Page C -> Page D

If there is a particular condition, if user click on back button of Page D, I need to redirect the user to Page A.

What is the best practice for this scenario?


Io ionic 3 We would have use registerasbackbutton event. But for ionic 4 this link might be helpful.
inside the event you can have your condition and navigate to the page you would like to.

1 Like