#使用AngularJS時,當路由發生改變時,我們需要做某些處理,此時可以監聽路由事件,常用的是$routeStartChange, $routeChangeSuccess
##使用場景:在路由配置文件routeConfig.js,對路由跳轉進行特殊處理經常用到
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());
});
}])
