ngTouch
The ngTouch module with the $swipe
service and
the ngSwipeLeft
and ngSwipeRight
directives are
deprecated. Instead, stand-alone libraries for touch handling and gesture interaction
should be used, for example HammerJS (which is also used by
Angular).
First, get the file:
"//ajax.googleapis.com/ajax/libs/angularjs/X.Y.Z/angular-touch.js"
npm install --save angular-touch@X.Y.Z
or
yarn add angular-touch@X.Y.Z
bower install angular-touch#X.Y.Z
"//code.angularjs.org/X.Y.Z/angular-touch.js"
where X.Y.Z is the AngularJS version you are running.
Then, include angular-touch.js
in your HTML:
<script src="path/to/angular.js"></script>
<script src="path/to/angular-touch.js"></script>
Finally, load the module in your application by adding it as a dependent module:
angular.module('app', ['ngTouch']);
With that you're ready to get started!
The ngTouch
module provides helpers for touch-enabled devices.
The implementation is based on jQuery Mobile touch event handling
(jquerymobile.com). *
See $swipe
for usage.
Name | Description |
---|---|
ngSwipeLeft | Specify custom behavior when an element is swiped to the left on a touchscreen device. A leftward swipe is a quick, right-to-left slide of the finger. Though ngSwipeLeft is designed for touch-based devices, it will work with a mouse click and drag too. |
ngSwipeRight | Specify custom behavior when an element is swiped to the right on a touchscreen device. A rightward swipe is a quick, left-to-right slide of the finger. Though ngSwipeRight is designed for touch-based devices, it will work with a mouse click and drag too. |
Name | Description |
---|---|
$swipe | The |