Skip to content

Instantly share code, notes, and snippets.

View nickeddy's full-sized avatar

Nick Eddy nickeddy

View GitHub Profile
@nelsonpecora
nelsonpecora / onAction.js
Last active August 29, 2015 14:00
Call a scope method when a certain key is pressed
app.directive('onAction', function() {
return {
priority: 1,
link: function(scope, elem, attrs) {
var keyMap = {
'enter': 13,
'space': 32
// add more keycodes from here: http://www.cambiaresearch.com/articles/15/javascript-char-codes-key-codes
},
keyCode = keyMap[attrs.actionKey];