angular-hammer-recognizers

1.0.1 • Public • Published

angular-hammer

angular-hammer is a Hammer.js adapter for AngularJS. It allows one to use directives which handle Hammer.js recognizers.

angular-hammer defines a single directive for each gesture recognizer. The directives are build in the following way: hm-{HAMMER_RECOGNIZER}, for instance hm-tap.

Installation

Using Bower:

$ bower install angular-hammer2 --save

Or manually, downloading a suitable file from dist directory.

Usage

To add a simple tap gesture recognizer use hmTap directive:

<div hm-tap="method($hmEvent)"></div>

If you want to specify more options use with keyword:

<div hm-tap="method($hmEvent) with { taps: 2 }"></div>

or hmTapOpts directive:

<div hm-tap="method($hmEvent)" hm-tap-opts="{ taps: 2 }"></div>

Optimized directives

In some situation you may want to add a gesture recognizer which does not trigger $digest cycle automatically. In order to do this, add -o prefix to the directive, e.g. hm-pan-o="method($hmEvent).

The following directives are available in an optimized form: pan, pinch, rotate.

Changelog

v1.0.1

  • Changed lib name to angular-hammer-recognizers.

v1.0.0

  • Directives based on HammerJS recognizers.

License

MIT

Dependents (0)

Package Sidebar

Install

npm i angular-hammer-recognizers

Weekly Downloads

2

Version

1.0.1

License

none

Last publish

Collaborators

  • dreame4