Skip to content
This repository has been archived by the owner on Sep 8, 2020. It is now read-only.

"$digest already in progress" error occurs when using onChange attribute with ui-ace 0.2.0 #89

Closed
ispringer opened this issue Jan 9, 2015 · 2 comments · Fixed by #90
Labels

Comments

@ispringer
Copy link

After upgrading to ui-ace 0.2.0, I get the following error when ui-ace calls my onChange function:

Error: [$rootScope:inprog] $digest already in progress
http://errors.angularjs.org/1.3.8/$rootScope/inprog?p0=%24digest
    at REGEX_STRING_REGEXP (https://localtest.evergage.com:8443/ui/bower_components/angular/angular.js:63:12)
    at beginPhase (https://localtest.evergage.com:8443/ui/bower_components/angular/angular.js:14737:15)
    at Scope.$get.Scope.$apply (https://localtest.evergage.com:8443/ui/bower_components/angular/angular.js:14481:11)
    at link.executeUserCallback (https://localtest.evergage.com:8443/ui/bower_components/angular-ui-ace/ui-ace.js:199:19)
    at Array.link.listenerFactory.onChange (https://localtest.evergage.com:8443/ui/bower_components/angular-ui-ace/ui-ace.js:237:15)
    at r._signal (https://localtest.evergage.com:8443/ui/bower_components/ace-builds/src-min-noconflict/ace.js:1:48711)
    at onChange (https://localtest.evergage.com:8443/ui/bower_components/ace-builds/src-min-noconflict/ace.js:1:149291)
    at r._signal (https://localtest.evergage.com:8443/ui/bower_components/ace-builds/src-min-noconflict/ace.js:1:48711)
    at removeInLine (https://localtest.evergage.com:8443/ui/bower_components/ace-builds/src-min-noconflict/ace.js:1:120868)
    at remove (https://localtest.evergage.com:8443/ui/bower_components/ace-builds/src-min-noconflict/ace.js:1:120408)

I am using Angular 1.3.8 and Ace 1.1.7.

Here's what my HTML looks like:

<div ng-model="formData.cssContent"
        ui-ace="{ useWrapMode: true, mode: 'css', onLoad: aceLoaded, onChange: contentChanged }"         
        ng-readonly="!contentEditable">
</div>
@douglasduteil
Copy link
Contributor

@ispringer I confirm the bug.
I think it's coming from executeUserCallback that apply whatever the phase
https://github.com/angular-ui/ui-ace/blob/src0.2.0/src/ui-ace.js#L199

douglasduteil added a commit that referenced this issue Jan 11, 2015
Prefer using $applyAsync than $apply.

Close #89
@douglasduteil
Copy link
Contributor

K It's now working for me in the version 0.2.1
http://plnkr.co/UPFemQK3kQLybIzRBItn

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

Successfully merging a pull request may close this issue.

2 participants