Reputation: 18909
I have a HTML structure that looks something like this:
<div ng-swipe-right="outerSwipe()">
...
<div ng-swipe-right="innerSwipe()">
...
</div>
</div>
When I do a swipe in the inner div, outerSwipe()
is also called.
Are there any workarounds?
Upvotes: 0
Views: 435
Reputation: 6187
as tymeJV suggested, you can add to your event handler event.stopPropagation() method that prevents the event from bubbling up the DOM tree.
Example:
app.directive('ngSwipeRight', function() {
return {
restrict: 'EA',
scope: { ngSwipeRight: '&' },
link:function(scope,element,attr){
element.bind("mouseenter",function(e){
e.stopPropagation();
//your logic here...
});
}
};
});
Live example: http://jsfiddle.net/choroshin/dmsw5/
Upvotes: 1