Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

$location.state problems in 1.3.0-rc.5  #9545

Closed
@bukharin

Description

@bukharin

My application stores some data in history state object. Before rc.5 version I used history.replaceState method. Now I rewrite my code to use new API: $location.state(obj).replace()

For instance:

$rootScope.$on('$locationChangeSuccess', function() {
       if(!$location.state())
              $location.state(Math.random()).replace();
});

It seems works fine, but when I click 'back' browser button (popstate event) - after that application stops responding on any link clicks (routes does not changes).

After investigate the source code I found that condition at angular.js:10905 always falsy

if (initializing || oldUrl !== $location.absUrl() ||
          ($location.$$html5 && $sniffer.history && oldState !== $location.$$state)) {
...
}

oldState and $location.$$state are equals after user click on the link

This problem in Chrome and FF. IE11 throws an exception after bootstrap:

Error: [$rootScope:infdig] 10 $digest() iterations reached. Aborting!
Watchers fired in the last 5 iterations: []
http://errors.angularjs.org/1.3.0-rc.5/$rootScope/infdig?p0=10&p1=%5B%5D
   at Scope.prototype.$digest (https://localhost:44300/vendor/angularjs/angular.js:13731:13)
   at Scope.prototype.$apply (https://localhost:44300/vendor/angularjs/angular.js:13955:13)
   at bootstrapApply (https://localhost:44300/vendor/angularjs/angular.js:1486:9)
   at invoke (https://localhost:44300/vendor/angularjs/angular.js:4133:7)
   at doBootstrap (https://localhost:44300/vendor/angularjs/angular.js:1484:5)
   at bootstrap (https://localhost:44300/vendor/angularjs/angular.js:1504:5)
   at Global code (https://localhost:44300/scripts/base/app.js:100:1)
SCRIPT5022: [$rootScope:infdig] 10 $digest() iterations reached. Aborting!
Watchers fired in the last 5 iterations: []
http://errors.angularjs.org/1.3.0-rc.5/$rootScope/infdig?p0=10&p1=%5B%5D

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions