Can you process additional logic when leaving the page?


#1

I have a page that is used for modifying settings for the user on my application. The application requires a manual save which some users may forget to do when moving to another page via the side-menu or going back with the hardware back-button.

Is it possible to process additional logic when a user tries to change their “url” to go to another state or page? For example in this event if a value on a form has been changed I would like to show a pop-up asking the user if they would like to save the changes or not before proceeding to the next page.

Thanks for any help.


#2

Please have a look at this ink http://ionicframework.com/docs/api/directive/ionView/


#3
$scope.$on('$ionicView.leave',function(){
//do something here
});

and there is beforeLeave also.