【发布时间】:2017-04-15 08:17:34
【问题描述】:
我正在将 Angular 1.5 应用程序迁移到 Angular UI Router 1.0-beta3 以使用组件路由器。我正在监听 $rootScope 上的状态更改事件,但没有触发任何事件。
例子:
angular
.module('app', [ 'ui.router' ])
.config(function($stateProvider) {
$stateProvider.state(
'dashboard',
{
url: '/dashboard',
component: 'dashboardComponent',
resolve: {
enabled: function() { throw new Error('NOT ENABLED'); }
}
});
})
.run(function($rootScope) {
$rootScope.$on('$stateChangeError', function() {
// Never called
});
});
组件路由是否支持状态变化事件?
【问题讨论】:
标签: javascript angularjs angular-ui-router angular-components