3 AngularJS directive that adds support for multi touch gestures to your app, based on hammer.js.
7 * Include `gestures.js` or `gestures.min.js` into your page
8 * Declare `'angular-gestures'` as a dependency for your angular app: `angular.module('myApp', ['angular-gestures']);`
9 * Use attributes on containers the same way you use `ng-click`: e.g. `hm-tap`
11 <button hm-tap="add_something()">Tap me</button>
13 * You can use angular interpolations like this : `hm-swipe="remove_something({{ id }})"`
14 * You can also use Hammer.js options by e.g. `hm-tap-opts="{hold: false}"`
18 Pass the `$event` object in the usual way e.g. `hm-drag="myDrag($event)"` then access its internals like so:
20 $scope.myDrag = function(event) {
21 console.log(event.gesture);
24 Refer to the [Hammer.js docs](https://github.com/EightMedia/hammer.js/wiki/Getting-Started) for more details on the properties of `event`.
29 * hmDoubleTap : 'doubletap',
30 * hmDragstart : 'dragstart',
32 * hmDragUp : 'dragup',
33 * hmDragDown : 'dragdown',
34 * hmDragLeft : 'dragleft',
35 * hmDragRight : 'dragright',
36 * hmDragend : 'dragend',
39 * hmPinchIn : 'pinchin',
40 * hmPinchOut : 'pinchout',
41 * hmRelease : 'release',
42 * hmRotate : 'rotate',
44 * hmSwipeUp : 'swipeup',
45 * hmSwipeDown : 'swipedown',
46 * hmSwipeLeft : 'swipeleft',
47 * hmSwipeRight : 'swiperight',
50 * hmTransformstart : 'transformstart',
51 * hmTransform : 'transform',
52 * hmTransformend : 'transformend'
55 All [Hammerjs events](https://github.com/EightMedia/hammer.js/wiki/Getting-Started) are supported. The corresponding Angularjs attribute has `hm-` prepended to the name. So for example, the 'doubletap' event becomes `hm-double-tap` etc.
57 *Attention* : *end and *start events are NOT CamelCased because of issues caused by $animate interference.
60 To set recognizer default options you can use `hammerDefaultOptsProvider`. Access it like in the demo:
63 angular.module('angularGesturesDemoApp', ['angular-gestures', 'ngRoute'])
64 .config(function ($routeProvider, hammerDefaultOptsProvider) {
67 templateUrl: 'views/main.html',
68 controller: 'MainCtrl'
73 hammerDefaultOptsProvider.set({
74 recognizers: [[Hammer.Tap, {time: 250}]]
80 If you want to use angular-momentum-scroll with bower, add the following dependency to your component.json
82 `"angular-gestures": "latest"`