【发布时间】:2015-03-10 16:05:21
【问题描述】:
路线配置:
$stateProvider.state('root', {
url: "/",
template: '<div ui-view></div>'
})
.state('root.child',{
url: '/child',
templateUrl: 'some.html'
controller: function(){
console.log('child')
}
});
StateChangeStart 监听器:
$scope.$on('$stateChangeStart', function (event, state, params, fromState, fromParams) {
console.log('state change start');
}
});
当我导航到状态“root.child”时,首先在控制台上打印“状态更改开始”,然后打印“孩子”。 但是当我在子状态下刷新页面或直接点击url'/child'时,首先打印'child'然后打印'state change start'。请帮忙。
【问题讨论】:
标签: angularjs angular-ui-router