Skip to content

$digest already in progress - timing problem during $apply/$digest phase? #45

@scroach

Description

@scroach

I am currently trying to add IndexedDB support to my application as alternative to WebSQL.
During refactoring I came upon an error on some pages which appears to only happen in Firefox.

Error: [$rootScope:inprog] $digest already in progress
http://errors.angularjs.org/1.4.5/$rootScope/inprog?p0=%24digest

I've tracked down the problem to the method createDatabaseConnection where $rootScope.$apply is called.
Funny thing is that this only occurs on pages where I use ng-include with the onload attribute.
<ng-include src="'js/shared/map.html'" onload="loadMap()"></ng-include>
The onload simply calls a method in the $rootscope which does some initializing for Openlayers.

I currently don't understand why this happens or if I am doing something wrong.
One workarround I found is to delay the init method via calling setTimeout but I would be happy with something more robust and permanent.
Are the calls to $apply necessary? Or is there any way to prevent this error?

If I've got time I might try to upload an example, but I don't know if it's that easy to reproduce without the environment.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions