Skip to content
This repository was archived by the owner on Dec 13, 2018. It is now read-only.

Error: [$rootScope:infdig] 10 $digest() iterations reached. #20

Open
robertjd opened this issue May 27, 2015 · 3 comments
Open

Error: [$rootScope:infdig] 10 $digest() iterations reached. #20

robertjd opened this issue May 27, 2015 · 3 comments

Comments

@robertjd
Copy link
Member

While building your Angular application with this module, you may encounter this error:

Error: [$rootScope:infdig] 10 $digest() iterations reached. Aborting!
Watchers fired in the last 5 iterations: []

This happens when your default view (main if you are following our Angular Guide) is using the waitForUser option. The cause is this upstream bug: angular-ui/ui-router#600

Workaround:

Instead of this:

$urlRouterProvider
  .otherwise('/');

Use this:

$urlRouterProvider.otherwise( function($injector, $location) {
    var $state = $injector.get("$state");
    $state.go("main"); //redirect to a 404 page
});

If you are using our Angular Guide to create a project from scratch, that code will go into client/app.js

@ashishbajaj99
Copy link

Great, thanks a lot Robert!

@agupta1989
Copy link

Yes, it was eating my brain. Thanks a lot @robertjd . Would you please also explain why this was happening with simple $urlRouterProvider.other('/') call and not with the alternative ?

@robertjd
Copy link
Member Author

robertjd commented Jul 8, 2015

I'd look at the linked issue above, for UI-Router - it explains the nuances of the issue.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants