mirror of
https://github.com/DeviceFarmer/stf.git
synced 2026-04-22 22:05:21 +02:00
13 lines
327 B
JavaScript
13 lines
327 B
JavaScript
module.exports = function ngEnterDirective() {
|
|
return function(scope, element, attrs) {
|
|
element.bind('keydown keypress', function(event) {
|
|
if (event.which === 13) {
|
|
scope.$apply(function() {
|
|
scope.$eval(attrs.ngEnter, {event: event})
|
|
})
|
|
event.preventDefault()
|
|
}
|
|
})
|
|
}
|
|
}
|