diff options
author | thuva4 <tharma.thuva@gmail.com> | 2018-02-28 21:56:23 +0530 |
---|---|---|
committer | thuva4 <tharma.thuva@gmail.com> | 2018-02-28 21:56:23 +0530 |
commit | 788d670037a77b35148551ebecf1314146e5a4b7 (patch) | |
tree | 9b5b56d32fff75d8072ce1daf89d188225d00921 /testapi/opnfv_testapi/ui/app.js | |
parent | 30c27c5b753413f397a9123bfc45d44de2c3579b (diff) |
Add enter to search
Add directive to filter the list by enter
JIRA: RELENG-351
Change-Id: I1abc92cdf2cb103e1ba9b685437b65035c88dd5d
Signed-off-by: thuva4 <tharma.thuva@gmail.com>
Diffstat (limited to 'testapi/opnfv_testapi/ui/app.js')
-rw-r--r-- | testapi/opnfv_testapi/ui/app.js | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/testapi/opnfv_testapi/ui/app.js b/testapi/opnfv_testapi/ui/app.js index ae50166..def88d2 100644 --- a/testapi/opnfv_testapi/ui/app.js +++ b/testapi/opnfv_testapi/ui/app.js @@ -42,6 +42,21 @@ }; }]); + angular + .module('testapiApp') + .directive('ngEnter', function () { + return function (scope, element, attrs) { + element.bind("keydown keypress", function (event) { + if(event.which === 13) { + scope.$apply(function (){ + scope.$eval(attrs.ngEnter); + }); + event.preventDefault(); + } + }); + }; + }); + configureRoutes.$inject = ['$stateProvider', '$urlRouterProvider']; /** |