Keyboard behavior for AngularJS Webapps
npm install angular-keyboardKeyboard behavior for AngularJS Webapps.
(But the directives also respond to touch & mouse events)
* Bring desktop-class keyboard navigation to webapps.
* Add behavior without adding styling or new scopes.
* No additional plugins required. (jQuery is optional)
* kbList & kbSelect demo
* Scroll and orientation demo
* kbFocus demo
* kbInvoke demo
``shell`
npm install angular-keyboard --save
`shell`
bower install angular-keyboard --save
Then add a
`
And add the 'keyboard' module as dependency.
`js`
angular.module('myApp', ['keyboard']);
A kb-item in a kb-list can selected using the arrow keys and by clicking on the kb-item.
#### Example
`html`
{{item.title}}
Example styling
`css`
[kb-item] {
cursor: pointer;
}
[kb-item].kb-selected {
background: lightblue;
}
A kb-item in a kb-select can activated using the arrow keys but is selected (and deselected) by pressing 'space' or 'enter' keys or clicking an the kb-item.
#### Example
`html`
{{item.title}}
Setting or reading the focus via a service.
`html`
`js`
app.controller('MyCtrl', function($scope, kbFocus) {
$scope.someAction = function() {
kbFocus('label');
};
});
Set the autofocus attribute based on an expression.
`html`
An event handler for kb-item. Triggered when clicked or (when focused) with space and enter keys.
`html`
* Install node.js
* Install gulp: npm install -g bower gulpnpm install
* Install dependencies: in the repository directory.gulp build
* to buildgulp watch` for building & livereload on every change.
*