var lastRoute = $route.current; $scope.$on('$locationChangeSuccess', function(event) { $route.current = lastRoute; });
..并确保$route在注入过程中的controller。
但尽管如此,感觉就像“DoNotFollowRoutesOnPathChange”是AngularJS缺少的功能。
自从听了这个事件有效杀死的$routeProvider
CONFIGS进一步使用,我不得不这样获限制为仅当前路径:
var lastRoute = $route.current; if ($route.current.$route.templateUrl.indexOf('mycurrentpath') > 0) { $route.current = lastRoute; }