Detect ionic Nav Back Button pressed on specific page


#1

I have several form pages and want to be able to detect when the user presses the ionic nav back button to warn them they are navigating away from the form and ask if they are sure they want to leave.

Is there a way to listen for this event in the view controller or attach an onclick event somehow?

Thanks,

RGecy


#2

i would focus on the stateChange and not so much the button click.

$rootScope.$on('$stateChangeStart', 
   function (event, toState, toParams, fromState, fromParams) {
   })

https://github.com/angular-ui/ui-router/wiki#state-change-events


#3

Thanks, I am just not sure how to implement it using stateChange though. I know I cant be the only one who has wanted to do this?