Skip to content
This repository has been archived by the owner on May 29, 2019. It is now read-only.

Angular UI typeahead and "$apply already in progress" #2652

Closed
satpalsingh opened this issue Sep 2, 2014 · 3 comments
Closed

Angular UI typeahead and "$apply already in progress" #2652

satpalsingh opened this issue Sep 2, 2014 · 3 comments

Comments

@satpalsingh
Copy link

I have an image, which you can click on to open a file input. When I added a typeahead on the same page, the opening of the file input stopped working and the following error on the console:

Error: [$rootScope:inprog] $apply already in progress

example to reproduce: http://plnkr.co/edit/zc4BNm?p=preview

Source: https://groups.google.com/forum/#!topic/angular/mP4bVZsoc28

@chrisirhc
Copy link
Contributor

Looks like a bug, dismissClickHandler shouldn't call $digest if typeahead isn't open or interacted with.

@segevofer
Copy link

i had the same problem..

@satpalsingh
Copy link
Author

I solved the problem using taking angular out of picture. I used inline-event handler onclick like

<img onclick="document.getElementById('image').click()" />
<input id="image" type="file" />

instead of

HTML

<img ng-src="{{imageUri}}" ng-click="clickImage()" />

SCRIPT

$scope.clickImage = function() {
       $("#image").click();
};

http://plnkr.co/edit/7P9WrxzT6pJ9MDz8sh65?p=preview

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

Successfully merging a pull request may close this issue.

4 participants