使用 angular-ui-router,$on监听事件变化时
$locationChangeSuccess 能监听到,
$stateChangeSuccess 监听不到,是什么原因;
代码如下:
.run(['$rootScope','$location', function($rootScope, $location) {
$rootScope.$on('$stateChangeSuccess', function(newV) {//****这是无效的
$rootScope.path = $location.path();
});
$rootScope.$on('$locationChangeSuccess', function(newV) {
$rootScope.path = $location.path();
});
}])