diff --git a/src/service/route.js b/src/service/route.js index ddc3df493729..261c9029efc7 100644 --- a/src/service/route.js +++ b/src/service/route.js @@ -116,6 +116,7 @@ angularServiceInject('$route', function($location, $routeParams) { rootScope = this, dirty = 0, forceReload = false, + stopUpdate = false, $route = { routes: routes, @@ -250,6 +251,14 @@ angularServiceInject('$route', function($location, $routeParams) { return match ? dst : null; } + function stopUpdateCallback() { + stopUpdate = true; + } + + function refreshUpdateState() { + stopUpdate = false; + } + function updateRoute() { var next = parseRoute(), last = $route.current, @@ -262,7 +271,11 @@ angularServiceInject('$route', function($location, $routeParams) { last.scope && last.scope.$emit('$routeUpdate'); } else { forceReload = false; - rootScope.$broadcast('$beforeRouteChange', next, last); + rootScope.$broadcast('$beforeRouteChange', next, last, stopUpdateCallback); + if(stopUpdate) { + refreshUpdateState(); + return; + } last && last.scope && last.scope.$destroy(); $route.current = next; if (next) {