Ionic history go back


I have a requirement in my app, when the user clicks ‘back button’ they have to land on the ‘parent-page’. Its representation can be seen below.

Main page --> Page A–>Page B–>page C

In the above representation, when the user lands on page C, and then when he clicks the back button instead of landing in Page B ,he should be able to see or direct to ‘Main page’.

It would be really helpful, if someone can provide me the solution for this.


use $ionicPlatform.registerBackButtonAction