我的结论是否正确,除非我使用 $state.transitionTo,否则 $stateChangeSuccess 不会触发?例如:
//in app config
.state('detail.zoom', {
url: '/zoom/{itemId}',
templateUrl: 'detail/zoom-partial.html'
})
//in html
<a href="#/zoom/{{item.id}}" >ZOOM IT!</a>
//in directive
scope.$state.transitionTo('detail.zoom', { itemId: item.id});
//in some controller
$scope.$on('$stateChangeSuccess', function () {alert('done transitioning!')});
来自 transitionTo 的事件会触发 $stateChangeSuccess,但对于 href 版本而言并非如此。有没有办法为两种类型的转换平等地触发事件?