Skip to content
This repository has been archived by the owner on Nov 22, 2021. It is now read-only.

Error: $apply already in progress #406

Closed
christiams opened this issue Mar 19, 2015 · 28 comments
Closed

Error: $apply already in progress #406

christiams opened this issue Mar 19, 2015 · 28 comments

Comments

@christiams
Copy link

Error: [$rootScope:inprog] $apply already in progress
http://errors.angularjs.org/1.3.14/$rootScope/inprog?p0=%24apply
at REGEX_STRING_REGEXP (VM3156 angular.js:63)
at beginPhase (VM3156 angular.js:14755)
at Scope.$get.Scope.$apply (VM3156 angular.js:14499)
at getFocus (VM3232 security.js:731)
at Object.link.scope.eventHandlers.host.click (VM3221 ng-tags-input.js:286)
at $parseFunctionCall (VM3156 angular.js:12345)
at VM3161 angular-touch.min.js:12
at Scope.$get.Scope.$eval (VM3156 angular.js:14401)
at Scope.$get.Scope.$apply (VM3156 angular.js:14500)
at HTMLDivElement. (VM3161 angular-touch.min.js:12)

to be exact it gets thrown at :
host: {
click: function() {
input[0].focus();
}
}

This error is for 1.3.14 angular version?

@cheonhyangzhang
Copy link

I am seeing this error as well.
I think this only happens recently. When you click on the input field for tags, this error is thrown.

I don't have this issue with the old version. So I guess this might be because recent changes?

@mbenford
Copy link
Owner

Are you using ng-focus along with ngTagsInput?

@christiams
Copy link
Author

Yep, when i comment another ng-focus the problem is solved.

2015-03-23 14:32 GMT-03:00 Michael Benford [email protected]:

Are you using ng-focus along with ngTagsInput?


Reply to this email directly or view it on GitHub
#406 (comment)
.

Atentamente,

Christian Carrillo C.

@mbenford
Copy link
Owner

What do you mean by "another ng-focus"? Are you using more than one at once?

@zapbr
Copy link

zapbr commented Mar 25, 2015

Same issue.
On click on input, throw the same error.

@jaybayley
Copy link

I am seeing a similar issue. The first time the input is focussed, it is fine. Any subsequent focus's seem to trigger the '$apply is already in progress' error. My stack trace is slightly different:

Error: [$rootScope:inprog] $apply already in progress
http://errors.angularjs.org/1.2.16/$rootScope/inprog?p0=%24apply
    at angular.js:78
    at beginPhase (angular.js:12720)
    at Scope.$get.Scope.$apply (angular.js:12509)
    at HTMLInputElement.<anonymous> (angular.js:18626)
    at HTMLInputElement.jQuery.event.dispatch (jquery.js:4430)
    at HTMLInputElement.jQuery.event.add.elemData.handle (jquery.js:4116)
    at Object.d.directive.link.b.eventHandlers.host.click (ng-tags-input.min.js:1)
    at Parser.functionCall (angular.js:10567)
    at angular-touch.js:438
    at Scope.$get.Scope.$eval (angular.js:12412)

I am using Angular v1.2.16, ngTagsInput v2.3.0 and jQuery v2.1.3.

@mbenford
Copy link
Owner

@jaybayley ngTagsInput requires Angular 1.2.24+. Please update to any version between 1.2.24 and 1.2.28.

That also applies to anyone else here using some version of Angular below 1.2.24.

@jaybayley
Copy link

Thanks @mbenford for the quick response, upgrading to 1.2.28 fixed the issue for me. it would be useful to update the bower config, it is showing as requiring >=1.2.1, otherwise I would have got there on my own :)

@mbenford
Copy link
Owner

@jaybayley I didn't know the bower config was outdated. Sorry for that :(

@jaybayley
Copy link

No problem at all, I hugely appreciate your quick response, for making an awesome plugin for us all to enjoy, and for continuing to provide support 👍

@mbenford
Copy link
Owner

mbenford commented Apr 4, 2015

Any update on this?

@nobitagit
Copy link

Had the same issue of this thread and I confirm that upgrading Angular solves the problem.

@mbenford
Copy link
Owner

mbenford commented Apr 8, 2015

@christiams @cheonhyangzhang could you guys confirm that this issue is solved by updating Angular?

@cheonhyangzhang
Copy link

@mbenford Hi Sorry I have been busy recently. I have verified that I was using angular 1.2.16. After upgrading to angular 1.2.24. The error has gone.

So 1.2.24 is working for me. Not sure if it is the least working version.

@mbenford
Copy link
Owner

@christiams Any update on this?

@umeshv
Copy link

umeshv commented Apr 16, 2015

Hi @mbenford

I am facing the same issue, the error is occuring on the below line of code

    host: {
       click: function() {
           if (scope.disabled) {
                return;
           }
           input[0].focus();
         }
    }

I can confirm that I am using the newer version of angular (v1.3.0) and jQuery (2.1.1). Also I am not using ng-focus.

@oduwole
Copy link

oduwole commented Apr 18, 2015

hi @mbenford, angularjs version 1.2.24 to 1.2.8 is not working with my project template, the version of workable angularjs is 1.2.0 and 1.2.4. Is there any other work around.

@makallio85
Copy link

I am facing this with version 2.3.0 and AngularJS 1.2.9 with no extra configurations.

Error occurs while focusing to input or removing any tags by mouse. Any workarounds?

Used it with params

ng-model="tags" 
max-tags="5"

My scripts and load order:

moment-with-locales.js
jquery.min.js
owl.carousel.js
jqcloud.js
angular-1.2.9.min.js
bootstrap.min.js
ui-bootstrap-tpls-0.12.1.min.js
ng-infinite-scroll.min.js
xeditable.min.js
checklist-model.js
ng-tags-input.js
bootstrap-tagsinput.min.js
main_angular.js
chart.min.js
bootbox.min.js

Error that can be seen in console

Error: [$rootScope:inprog] http://errors.angularjs.org/1.2.9/$rootScope/inprog?p0=%24apply
    at Error (native)
    at http://localhost/testapp/js/angular-1.2.9.min.js:6:449
    at m (http://localhost/testapp/js/angular-1.2.9.min.js:96:353)
    at h.$get.h.$apply (http://localhost/testapp/js/angular-1.2.9.min.js:103:31)
    at HTMLInputElement.<anonymous> (http://localhost/testapp/js/angular-1.2.9.min.js:179:65)
    at HTMLInputElement.m.event.dispatch (http://localhost/testapp/js/jquery.min.js:3:8549)
    at HTMLInputElement.m.event.add.r.handle (http://localhost/testapp/js/jquery.min.js:3:5259)
    at Object.tagsInput.directive.link.scope.eventHandlers.host.click (http://localhost/testapp/js/ng-tags-input.js:347:34)
    at Ya.functionCall (http://localhost/testapp/js/angular-1.2.9.min.js:162:407)
    at http://localhost/testapp/js/angular-1.2.9.min.js:179:83

@oleksiyo
Copy link

Hi everyone.
Can be fixed this problem without updating angular version. Maybe some tricks?
I'm use AngularJS v1.2.16

@oduwole
Copy link

oduwole commented Apr 21, 2015

how? @oleksiyo

@mbenford
Copy link
Owner

@oduwole @makallio85 @umeshv Could you guys provide a plunker or something showing your problems?

@oleksiyo Angular needs to be updated to at least v1.2.24 because a bug in ngFocus & ngBlur was fixed in that version. It's not a problem in ngTagsInput.

@devshane
Copy link

devshane commented May 5, 2015

Hi @mbenford, this Plunker shows the problem with 1.3.15: http://plnkr.co/edit/CgiIUOWWwsny13O9GvOR?p=preview. It seems like the second focus event triggers the error. Focus, blur, focus and boom. If not, adding and removing a tag seems to do it as well.

Error: [$rootScope:inprog] $apply already in progress
http://errors.angularjs.org/1.3.15/$rootScope/inprog?p0=%24apply
    at angular.js:63
    at beginPhase (angular.js:14820)
    at Scope.$apply (angular.js:14564)
    at HTMLInputElement.<anonymous> (script.js:13)
    at HTMLInputElement.eventHandler (angular.js:3032)
    at Object.scope.eventHandlers.host.click (ng-tags-input.js:347)
    at $parseFunctionCall (angular.js:12404)
    at callback (angular.js:21566)
    at Scope.$eval (angular.js:14466)
    at Scope.$apply (angular.js:14565)

Thanks.

@chobitsky
Copy link

Hello
I am also troubled same problem is happening.
AngularJS 1.3.0
ngTagsInput 2.3.0

It happens only when you first click on the input tag on smartphones such as the iPhone.
Operation itself appears to be running normally, but is worried because the error has come out to the console log.

Official as there is 1.3.0, such as not officially support description, but how about you plan when it is officially supported around?
I think the busy, but we have support.

thank you

@oduwole
Copy link

oduwole commented Jun 1, 2015

@mbenford solved it. upgrade angularjs to 1.2.24

@davidgabrichidze
Copy link

I have same issue. I'm using angular 1.4.7
solution is to use $timeout: e.g. $timeout(function () { input[0].focus() });
I've changed code (you have 2 times used input[0].focus()), and it solved issue.

@VirendraWankhede
Copy link

VirendraWankhede commented Jun 8, 2016

I have same problem. I have fixed it for Ng2 by upgrading but for Angular 1.5 i don't want to upgrade, Here is my error :
Error: [$rootScope:inprog] http://errors.angularjs.org/1.5.0/$rootScope/inprog?p0=%24digest at Error (native)

@mbenford
Copy link
Owner

This issue was selected to be spring-cleaned by a script. More information can be found here.

If anyone thinks this was a mistake and this issue should be reopened, please leave a message below explaining why. Before doing so, please consider reading the CONTRIBUTING file.

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

No branches or pull requests