Issue
I have HTML structure with ng-click:
<div ng-click="parent()">
  <div ng-click="d"></div>
</div>
How I can disable outside ng-click="parent()" if I do ng-click="d"
Solution
Use the stopPropagation method on the angular $event object:
<div ng-click="parent()">
  <div ng-click="d(); $event.stopPropagation();"></div>
</div>
Or pass the $event object as an argument of the ng-click method, and call stopPropagation in the method:
<div ng-click="parent()">
  <div ng-click="d($event)"></div>
</div>
In d:
$scope.d = function (event) {
    // ...
    event.stopPropagation();
}
Answered By - Michael P. Bazos
 
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.