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.

infinite $digest when using history api #6976

Closed
@mrhooray

Description

@mrhooray

I encountered this issue when using Dropbox Datastore API, which invokes history.replaceState after OAuth redirection. By adding a callback to $routeChangeStart event, it seems the app is doing routing repeatedly.

Only use $location may not always be possible when involving third party library or other app. Is there a workaround or imminent fix on this?

Angular Version(s): 1.2.15
Browsers and Operating System: Chrome 33 on OS X 10.9
Reproduce Error: http://jsfiddle.net/7t7eK/ from #1417 with Angular 1.2.15
Related issues: #1417 , #3924

Error and trace that I got:

10x on $routeChangeStart
Error: [$rootScope:infdig] 10 $digest() iterations reached. Aborting!
Watchers fired in the last 5 iterations: [["fn: $locationWatch; newVal: 7; oldVal: 6"],["fn: $locationWatch; newVal: 8; oldVal: 7"],["fn: $locationWatch; newVal: 9; oldVal: 8"],["fn: $locationWatch; newVal: 10; oldVal: 9"],["fn: $locationWatch; newVal: 11; oldVal: 10"]]
http://errors.angularjs.org/1.2.15/$rootScope/infdig?p0=10&p1=%5B%5B%22fn%3…2fn%3A%20%24locationWatch%3B%20newVal%3A%2011%3B%20oldVal%3A%2010%22%5D%5D
    at http://localhost:9000/bower_components/angular/angular.js:78:12
    at Scope.$digest (http://localhost:9000/bower_components/angular/angular.js:12070:19)
    at Scope.$apply (http://localhost:9000/bower_components/angular/angular.js:12279:24)
    at http://localhost:9000/bower_components/angular/angular.js:1382:15
    at Object.invoke (http://localhost:9000/bower_components/angular/angular.js:3805:17)
    at doBootstrap (http://localhost:9000/bower_components/angular/angular.js:1380:14)
    at bootstrap (http://localhost:9000/bower_components/angular/angular.js:1394:12)
    at angularInit (http://localhost:9000/bower_components/angular/angular.js:1307:5)
    at http://localhost:9000/bower_components/angular/angular.js:21163:5
    at HTMLDocument.trigger (http://localhost:9000/bower_components/angular/angular.js:2445:7) angular.js:9563
(anonymous function) angular.js:9563
(anonymous function) angular.js:7004
Scope.$apply angular.js:12281
(anonymous function) angular.js:1382
invoke angular.js:3805
doBootstrap angular.js:1380
bootstrap angular.js:1394
angularInit angular.js:1307
(anonymous function) angular.js:21163
trigger angular.js:2445
(anonymous function) angular.js:2716
forEach angular.js:330
eventHandler angular.js:2715

Uncaught Error: [$rootScope:infdig] 10 $digest() iterations reached. Aborting!
Watchers fired in the last 5 iterations: [["fn: $locationWatch; newVal: 7; oldVal: 6"],["fn: $locationWatch; newVal: 8; oldVal: 7"],["fn: $locationWatch; newVal: 9; oldV...<omitted>...5D angular.js:78
(anonymous function) angular.js:78
Scope.$digest angular.js:12070
Scope.$apply angular.js:12279
(anonymous function) angular.js:1382
invoke angular.js:3805
doBootstrap angular.js:1380
bootstrap angular.js:1394
angularInit angular.js:1307
(anonymous function) angular.js:21163
trigger angular.js:2445
(anonymous function) angular.js:2716
forEach angular.js:330
eventHandler angular.js:2715
on $routeChangeStart 
on $routeChangeStart 
on $routeChangeStart 

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions