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.
Angular JS Touch and Swipe
21.6k Views Asked by user3311330 At
3
There are 3 best solutions below
0

In html i used 5 tabs and i am able to swipe left or right smoothly. my code given below.
RECEIVED | SENT | DELETED | ARCHIVED Reports
In html
ng-swipe-left="leftTab()" ng-swipe-right="rightTab()"
and In controller.
$scope.leftTab = function(){
if($scope.tab != 4 ){
$scope.getAlertsSummary($scope.tab + 1);
}
};
$scope.rightTab = function(){
if($scope.tab != 0 ){
$scope.getAlertsSummary($scope.tab - 1);
}
};
Here getAlertsSummary used for get tab data.
0

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
Another option is the angular-swipe module. It replaces
ng-swipe
and uses the same directives, adding up and down: