Skip to content

Commit b4f600f

Browse files
author
Norik Davtian
committed
Send original event to triggerHandler and bypass prevent ghost click if no coordinates.
If there is anchor with ng-click on it the click event was not triggering. fixes angular#12082
1 parent 2a85a63 commit b4f600f

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/ngTouch/directive/ngClick.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,10 @@ ngTouch.directive('ngClick', ['$parse', '$timeout', '$rootElement',
109109
// Returns true if the click should be allowed.
110110
// Splices out the allowable region from the list after it has been used.
111111
function checkAllowableRegions(touchCoordinates, x, y) {
112+
if (!touchCoordinates.length) {
113+
return true; // If not coordinates that means we do not have a ghost click so bypass the check
114+
}
115+
112116
for (var i = 0; i < touchCoordinates.length; i += 2) {
113117
if (hit(touchCoordinates[i], touchCoordinates[i + 1], x, y)) {
114118
touchCoordinates.splice(i, i + 2);
@@ -260,7 +264,7 @@ ngTouch.directive('ngClick', ['$parse', '$timeout', '$rootElement',
260264
}
261265

262266
if (!angular.isDefined(attr.disabled) || attr.disabled === false) {
263-
element.triggerHandler('click', [event]);
267+
element.triggerHandler('click', [originalEvent]);
264268
}
265269
}
266270

0 commit comments

Comments
 (0)