Sergei Basharov
Sergei Basharov

Reputation: 53940

Distinguish swipe and click in Angular

I use ng-click to show details of an item in a list and also I attach jQuery mobile swipe event to the list item to show delete button when a user swipes to the left. The problem is that when I swipe on the element, it doesn't only emit swipe event, but click event as well. So, when I want to swipe to delete an element, it shows the delete button and opens details view.

What can I do about this? It would be cool to have something like ng-swipe.

Upvotes: 7

Views: 2090

Answers (1)

jwanga
jwanga

Reputation: 4256

The most recent unstable angularjs (1.1.4+) builds include both an ngSwipeLeft and ngSwipeRight directive. You must take care to reference the angular-mobile.js library.

https://github.com/angular/angular.js/blob/master/src/ngMobile/directive/ngSwipe.js

Upvotes: 3

Related Questions