xtform icon indicating copy to clipboard operation
xtform copied to clipboard

xtForm and UI Bootstrap $apply already in progress

Open larixer opened this issue 9 years ago • 3 comments

When you try to run UI bootstrap popup datepicker (https://angular-ui.github.io/bootstrap/) inside xtForm form it will result in the following error:

Error: [$rootScope:inprog] $apply already in progress http://errors.angularjs.org/1.3.15/$rootScope/inprog?p0=%24apply at REGEX_STRING_REGEXP (angular.js:63) at beginPhase (angular.js:14820) at Scope.$get.Scope.$apply (angular.js:14564) at HTMLInputElement. (xtForm.tpl.js:58) at HTMLInputElement.jQuery.event.dispatch (jquery.js:4435) at HTMLInputElement.jQuery.event.add.elemData.handle (jquery.js:4121) at Scope.link.scope.dateSelection (ui-bootstrap-tpls.js:1632) at $parseFunctionCall (angular.js:12404) at Scope.$get.Scope.$eval (angular.js:14466) at angular.js:20672

larixer avatar May 12 '15 08:05 larixer

@vlasenko Could you replicate that in http://plnkr.co/ ?

idreeshaddad avatar May 16 '15 09:05 idreeshaddad

I was able to reproduce this problem in Chrome + Angular 1.3, Angular ui 0.13.3 + xtform. Not sure if this was a xtform problem but could be due to Angular ui 0.13.3. A previous version of angular ui did not have this problem.

Eitherway, due to complexity and performance i noted in Angular ui datepicker, I am moving on to AngularStrap.

smurugavel avatar Aug 22 '15 12:08 smurugavel

@vlasenko I was running into the same issue. Changing the xtForm.js line 58 do the trick for me: scope.$apply() => scope.$evalAsync()

$evalAsync takes a function and schedules it to run later but still during the ongoing digest. Also $evalAsync triggers a digest when there is no one is running.

peng-at-gruden avatar Aug 26 '15 07:08 peng-at-gruden