This repository was archived by the owner on Apr 12, 2024. It is now read-only.
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
Calling element.click() causes "$apply already in progress" with ng-touch #12150
Closed
Description
With angular-touch installed and working fine, when calling element.click()
in the process of an $apply (where element
is a plain vanilla DOM element, gotten from something like $event.target
) causes an error $apply already in progress
.
Presumably this is because ng-touch registers a click handler on each and every element, which calls $apply again, which is no good for Angular.
I see two solutions possible:
- Fix angular-touch so that it doesn't do an $apply (for example, using $timeout is common practise)
- Fix Angular to allow calling $apply while another $apply is already in progress. This one makes the most sense to me. If an $apply is already happening, calling it again don't need to do anything at all.
All this is on Angular 1.4.1, angular-touch 1.4.1, no jQuery, and Firefox 38.