mirror of
https://github.com/portainer/portainer.git
synced 2025-07-30 18:59:41 +02:00
feat(services): bind enter key when scaling a service (#1560)
This commit is contained in:
parent
f52ac8fb12
commit
46da85c8cf
3 changed files with 22 additions and 5 deletions
18
app/directives/onEnterKey.js
Normal file
18
app/directives/onEnterKey.js
Normal file
|
@ -0,0 +1,18 @@
|
|||
angular.module('portainer')
|
||||
.directive('onEnterKey', [function porOnEnterKey() {
|
||||
var directive = {
|
||||
restrict: 'A',
|
||||
link: function(scope, element, attrs) {
|
||||
element.bind('keydown keypress', function (e) {
|
||||
if ( e.which === 13 ) {
|
||||
e.preventDefault();
|
||||
scope.$apply(function () {
|
||||
scope.$eval(attrs.onEnterKey);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
return directive;
|
||||
}]);
|
Loading…
Add table
Add a link
Reference in a new issue