Refactors most controllers and directives into classes for more organized and maintainable code
This commit is contained in:
14
app/assets/javascripts/directives/functional/snEnter.js
Normal file
14
app/assets/javascripts/directives/functional/snEnter.js
Normal file
@@ -0,0 +1,14 @@
|
||||
/* @ngInject */
|
||||
export function snEnter() {
|
||||
return function(scope, element, attrs) {
|
||||
element.bind('keydown keypress', function(event) {
|
||||
if (event.which === 13) {
|
||||
scope.$apply(function() {
|
||||
scope.$eval(attrs.snEnter, { event: event });
|
||||
});
|
||||
|
||||
event.preventDefault();
|
||||
}
|
||||
});
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user