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

Extent-change listener generates "$digest already in progress" #313

@CloudCees

Description

@CloudCees

We are using the v1 directives

Expected behavior

No errors in Console.

Actual behavior

Map.setExtent() sometimes generates the error as mentioned in the subject. I expect that when the extent is set it will not generate this error.

  • Provide any error messages you see in the console.
    "$digest already in progress"

Steps to reproduce the behavior

In the link below:

  • Open the browser's console
  • Press multiple time on the button 'set extent' until the error in the console appears.

https://embed.plnkr.co/6C7GsTibHykPJQcxeU2g/

For us working solution:

In esri code below, scope.$apply() is causing this error. When we change $apply to $evalAsync the error isn't appearing anymore.

map.on('extent-change', function(e) {
    if (attrs.extentChange) {
        self.extentChange()(e);
    }
    // prevent circular updates between $watch and $apply
    if (self.inUpdateCycle) {
        return;
    }
    self.inUpdateCycle = true;
    scope.$apply(function () {
        // update scope properties
        updateCenterAndZoom(self, map);
        $timeout(function() {
            // this will be executed after the $digest cycle
            self.inUpdateCycle = false;
        }, 0);
    });
});

For more information about $evalAsync:
http://stackoverflow.com/questions/12729122/angularjs-prevent-error-digest-already-in-progress-when-calling-scope-apply/23102223#23102223

With kind regards

Metadata

Metadata

Assignees

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions