diff --git a/src/ngTouch/directive/ngClick.js b/src/ngTouch/directive/ngClick.js index f352c252f443..f37c72b28286 100644 --- a/src/ngTouch/directive/ngClick.js +++ b/src/ngTouch/directive/ngClick.js @@ -144,7 +144,7 @@ ngTouch.directive('ngClick', ['$parse', '$timeout', '$rootElement', lastLabelClickCoordinates = null; } // remember label click coordinates to prevent click busting of trigger click event on input - if (nodeName_(event.target) === 'label') { + if (findUpLabel(event.target)) { lastLabelClickCoordinates = [x, y]; } @@ -163,6 +163,12 @@ ngTouch.directive('ngClick', ['$parse', '$timeout', '$rootElement', event.target && event.target.blur && event.target.blur(); } + function findUpLabel(el) { + while (el) { + if (nodeName_(el) === 'label') return true; + el = el.parentNode; + } + } // Global touchstart handler that creates an allowable region for a click event. // This allowable region can be removed by preventGhostClick if we want to bust it.