8000 fixes #12082 (ngTouch regression since 1.3) by NorikDavtian · Pull Request #13213 · angular/angular.js · GitHub
[go: up one dir, main page]

Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

fixes #12082 (ngTouch regression since 1.3) #13213

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
  • Loading branch information
Norik Davtian committed Oct 31, 2015
commit b4f600f67c918e45b4a16ef08e048c917180bfe2
6 changes: 5 additions & 1 deletion src/ngTouch/directive/ngClick.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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]);
}
}

Expand Down
0