angular 全局 监听路由变化
app.run(['$rootScope', '$location', function($rootScope, $location) { /* 监听路由的状态变化 */ $rootScope.$on('$routeChangeStart', function(evt, next, current){ console.log('route begin change'); }); $rootScope.$on('$routeChangeSuccess', function(evt, current, previous) { console.log('route have already changed :'+$location.path()); }); }]);