Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 742
Sergei Basharov Avatar asked May 22 '13 14:05

Sergei Basharov


1 Answers

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

like image 69
jwanga Avatar answered Nov 07 '22 10:11

jwanga