How to detect page change in ionic


#1

Suppose I am in page ‘A’ and moving to page ‘B’, then how do I detect that page is being changed?

It was something like this in jquery-mobile:

$(document).on("pagehide",function(){
});

How do I do the same using Ionic?


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