An angular.js long press directive for both desktop and mobile
npm install angular-long-pressThank you
GitHub Gist
, grrrian for Prevent long press while scrolling
This repository contains native AngularJS directives . The only required dependencies are:
* AngularJS (tested with 1.4.9 although it probably works with older versions)
bower install angular-long-press --save
Alternatively files can be downloaded downloaded from Github.
and copy the files from dist/. Then add the sources to your code (adjust paths as needed) after
adding the dependencies for Angular first:
``html`
Whichever method you choose the good news is that the overall size is very small: < 2.5kb for all directives (~0.5kb with gzip compression!)
As soon as you've got all the files downloaded and included in your page you just need to declare a dependency on the pr.longpress module:
`javascript`
angular.module('myModule', ['pr.longpress']);
`html`
There are several options that you can set as attributes on the directive element
1. on-long-press : method to be called when long press event is triggeredon-touch-end
2. : method to be called when touch end or mouse up event is triggeredprevent-click
3. : default true, to prevent click event getting triggered after long press is triggeredlong-press-duration
4. : default 600, Integer value in MS to indicate after how long user touches will trigger long-press eventprevent-onscrolling` : default true, Boolean value to prevent long press when user is scrolling.
5.
Please add a link to a plunker, jsbin, or equivalent.
angular-long-press.js is available under the MIT license.
