I am moving from AngularJS 1.3 to AngularJS 1.4 . And this time I'm using the new AngularJS new route, for example. ngNewRouter , which is introduced in AngularJS 1.4 .
My sample code is as follows:
var versionModule = ng.module('test', ['ngNewRouter']); versionModule.controller('TestController', ['$rootScope', '$router', function ($rootScope, $router) { var version = this; $router.config([ { path: '/', redirectTo: '/home' }, { path: '/home', component: 'home' } ]); $rootScope.$on('$routeChangeSuccess', function (event, current, previous) { console.log("This line is not getting printed ever."); }); }]);
Routing works fine, but $ routeChangeSuccess is never called :(.
Maybe the $ routeChangeSuccess lister will only be called with the ngRoute module, and I use ngNewRouter instead of ngRoute . If its true, then which lister should I bind instead of $ routeChangeSuccess ?
source share