I have this code snippet below (ionic framework) but routeChangeStart
is not printed when i'm navigating around.
.run(function($ionicPlatform, $rootScope, $location) {
$ionicPlatform.ready(function() {
if (window.cordova && window.cordova.plugins.Keyboard) {
cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
}
if (window.StatusBar) {
StatusBar.styleDefault();
}
});
$rootScope.$on('$routeChangeStart', function(event, next, current) {
console.info('[event] routeChangeStart...');
});
})
I believe that ionic framework is using ui-router instead of ngRoute..So change your code as follows and try...
$rootScope.$on('$stateChangeStart', function(event, toState, toParams, fromState, fromParams){
//print here
});
please look the following link for the difference between those router modules http://www.amasik.com/angularjs-ngroute-vs-ui-router/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With