Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Angular JS Touch and Swipe

I am very new to angular JS and working on a mobile application. As a part of it, I need to write a service that handles touch events like swipe-left, swipe-right, swipe-up and swipe down and I need to call back depending on which action is made. Please let me know if there any useful tutorials.

like image 250
user3311330 Avatar asked Jun 25 '14 05:06

user3311330


2 Answers

As mentioned in the comments ngTouch is a good place to start, however it only has swipe left and swipe right. I recommend using Angular Gestures; it's an angular implementation of hammer.js, and has pretty much everything you'd ever need:

  • doubletap
  • dragstart
  • drag
  • dragup
  • dragdown
  • dragleft
  • dragright
  • dragend
  • hold
  • pinch
  • pinchin
  • pinchout
  • release
  • rotate
  • swipe
  • swipeup
  • swipedown
  • swipeleft
  • swiperight
  • tap
  • touch
  • transformstart
  • transform
  • transformend
like image 123
SgtPepper43 Avatar answered Sep 28 '22 01:09

SgtPepper43


Another option is the angular-swipe module. It replaces ng-swipe and uses the same directives, adding up and down:

ng-swipe-up
ng-swipe-down
ng-swipe-left
ng-swipe-right
like image 35
Bradley Flood Avatar answered Sep 28 '22 02:09

Bradley Flood