【发布时间】:2014-03-03 15:35:34
【问题描述】:
假设我们有一个 /example 路由和关联的 ExampleCtrl:
.when('/example', {
templateUrl : 'example.html',
controller: 'ExampleCtrl'
})
&
ExampleCtrl = function(){
$scope.$on("$routeChangeSuccess", function(){
// is this guarantied to be called inside current scope?
}
}
大多数时候 $routeChangeSuccess 事件会在新创建的范围内触发,但我可以依赖这个假设吗?
【问题讨论】:
标签: angularjs controller angularjs-scope angularjs-controller angular-routing