Skip to content

Angular Directive for long press / touch event

Notifications You must be signed in to change notification settings

maaljam/alPress

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 

Repository files navigation

alPress

Angular Directive for long press for mobile and desktop

Features

  1. Works for both mobile (touch) and desktop (mouse) events
  2. Custom duration can be set
  3. on-press-end event can be attached

Install

  • Include the required source file (this path or similar)
<script src="dist/al-press.js"></script>
  • Inject the al-press module into your app.
angular.module('app', ['al-press']);

Usage

  • The basic use is as follows: (event will fire by default after 500ms long press)
<div al-press="onPress()">Click Me</div>
  • You can specify a custom duration like below
<div al-press="onPress($event)" duration="1000">Click Me</div>
  • You can attach another event that fires on press end
<div al-press on-press-end="onPressEnd()" >Click Me</div>
  • In Controller
scope.onPress = function(){
  alert('heeey');
};
scope.onPressEnd = function(){
  alert('heeey');
};

##Other Directives check out these other useful directives I made:

  1. alClick: Improved version of ngClick

About

Angular Directive for long press / touch event

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published