From ea9ca651d2dd40ec057a166c6f324ea4fb881428 Mon Sep 17 00:00:00 2001 From: Igor Minar Date: Sun, 6 Feb 2011 09:35:14 -0800 Subject: fix how redirection is handled and tested --- src/services.js | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'src/services.js') diff --git a/src/services.js b/src/services.js index eb0a473f..5c91aa59 100644 --- a/src/services.js +++ b/src/services.js @@ -693,7 +693,7 @@ function switchRouteMatcher(on, when, dstName) { */ -angularServiceInject('$route', function(location) { +angularServiceInject('$route', function(location, $updateView) { var routes = {}, onChange = [], matcher = switchRouteMatcher, @@ -818,15 +818,16 @@ angularServiceInject('$route', function(location) { if(routeParams) { if (routeParams.redirectTo) { - location.updateHash(routeParams.redirectTo); //let $browser trigger next route change + location.updateHash(routeParams.redirectTo); + $updateView(); //TODO this is to work around the $location<=>$browser issues return; - } else { - childScope = createScope(parentScope); - $route.current = extend({}, routeParams, { - scope: childScope, - params: extend({}, location.hashSearch, pathParams) - }); } + + childScope = createScope(parentScope); + $route.current = extend({}, routeParams, { + scope: childScope, + params: extend({}, location.hashSearch, pathParams) + }); } //fire onChange callbacks @@ -840,7 +841,7 @@ angularServiceInject('$route', function(location) { this.$watch(function(){return dirty + location.hash;}, updateRoute); return $route; -}, ['$location']); +}, ['$location', '$updateView']); /** * @workInProgress -- cgit v1.2.3