How to detect navigation event

Moderator: Support

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

How to detect navigation event

Post by Jackson »

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: 147
Joined: Tue Aug 27, 2013 1:47 pm

Re: How to detect navigation event

Post by Serhii Kulibaba »

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

Post by Jackson »

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: 147
Joined: Tue Aug 27, 2013 1:47 pm

Re: How to detect navigation event

Post by Serhii Kulibaba »

Glad to hear things are sorted out now!

Post Reply