Jackson
Posts: 9
Joined: Wed Nov 01, 2017 10:44 pm

How to detect navigation event

How can I add a listener for a navigation event so that I can save changes before I leave a page?

This is for ionic.

Serhii Kulibaba
Posts: 150
Joined: Tue Aug 27, 2013 1:47 pm

Re: How to detect navigation event

Hello Jackson,

Please use the event "Before page leaving" for that

Jackson
Posts: 9
Joined: Wed Nov 01, 2017 10:44 pm

Re: How to detect navigation event

I didn't see where that event was an option in ionic 1, but this worked as well:
$scope.$on('$destroy',function(){
// do something
});
Thanks for looking into it.

Serhii Kulibaba
Posts: 150
Joined: Tue Aug 27, 2013 1:47 pm

Re: How to detect navigation event

Glad to hear things are sorted out now!

Return to “Issues”