1.0.3 • Published 7 years ago

vi-angular-keypress v1.0.3

Weekly downloads
2
License
MIT
Repository
github
Last release
7 years ago

Angular Keypress

Description

AngularJS directive to help bind keyboard events to methods in the scope.

Installation

npm install --save vi-angular-keypress

or

bower install vi-angular-keypress

Require the module:

require('vi-angular-keypress');

Register the module into your main app module

angular.module('myApp', ['vivify-ideas.angular-keypress']);

Usage

In the template, use the vi-keypress attribute on the element to bind methods for different keypress.

<input type="text" vi-keypress="{ 13: 'enterPressed(someParam)', 27: 'escapePressed()' }">

If the Enter key (char code 13) is pressed the method enterPressed is invoked in your scope, while if escape key (char code 27) is pressed the escapePressed method is invoked.

License

MIT