$ionicView.beforeLeave not firing


#1

Hey guys I’m trying to catch the event $ionicView.beforeLeave and it’s not working.

$scope.$on('$ionicView.beforeLeave', function(){ //My code here });

I’m on the version 1.0.0-beta.14 of ionic


#2

I’m maybe not very specific, I’ll try to give more infos.
The weird thing is if I’m trying to attach $on on the $rootScope the event is well firing but 2 times, I thought it was normal because of the loading of the scope before the displaying of the view (so the event is fire because of the leaving of the preview view).
An other weird thing is in the same controller I have a event of $ionicView.beforeEnter attach to the own scope of the controller and this one is fired well.

Is anybody already have this issue ?


#3

This worked out for me: