From b4f600f67c918e45b4a16ef08e048c917180bfe2 Mon Sep 17 00:00:00 2001 From: Norik Davtian Date: Fri, 30 Oct 2015 21:55:31 -0700 Subject: [PATCH] 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 #12082 --- src/ngTouch/directive/ngClick.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/ngTouch/directive/ngClick.js b/src/ngTouch/directive/ngClick.js index f352c252f443..631789251412 100644 --- a/src/ngTouch/directive/ngClick.js +++ b/src/ngTouch/directive/ngClick.js @@ -109,6 +109,10 @@ ngTouch.directive('ngClick', ['$parse', '$timeout', '$rootElement', // Returns true if the click should be allowed. // Splices out the allowable region from the list after it has been used. function checkAllowableRegions(touchCoordinates, x, y) { + if (!touchCoordinates.length) { + return true; // If not coordinates that means we do not have a ghost click so bypass the check + } + for (var i = 0; i < touchCoordinates.length; i += 2) { if (hit(touchCoordinates[i], touchCoordinates[i + 1], x, y)) { touchCoordinates.splice(i, i + 2); @@ -260,7 +264,7 @@ ngTouch.directive('ngClick', ['$parse', '$timeout', '$rootElement', } if (!angular.isDefined(attr.disabled) || attr.disabled === false) { - element.triggerHandler('click', [event]); + element.triggerHandler('click', [originalEvent]); } }