diff options
| author | Igor Minar | 2011-02-06 09:35:14 -0800 | 
|---|---|---|
| committer | Igor Minar | 2011-02-06 09:35:14 -0800 | 
| commit | ea9ca651d2dd40ec057a166c6f324ea4fb881428 (patch) | |
| tree | 2852c04856533e2dfa262997647d7d74f09412b5 /src | |
| parent | d6db4b174940782867d1cf42e1e0152046fe05c1 (diff) | |
| download | angular.js-ea9ca651d2dd40ec057a166c6f324ea4fb881428.tar.bz2 | |
fix how redirection is handled and tested
Diffstat (limited to 'src')
| -rw-r--r-- | src/angular-mocks.js | 2 | ||||
| -rw-r--r-- | src/services.js | 19 | 
2 files changed, 11 insertions, 10 deletions
| diff --git a/src/angular-mocks.js b/src/angular-mocks.js index 1093b061..762148fd 100644 --- a/src/angular-mocks.js +++ b/src/angular-mocks.js @@ -91,8 +91,8 @@ function MockBrowser() {      self.pollFns.push(        function() {          if (self.lastUrl != self.url) { -          listener();            self.lastUrl = self.url; +          listener();          }        }      ); 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) {        </doc:scenario>      </doc:example>   */ -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 | 
