angularJS文本框根据输入字符(文本框值)进行查询ng-keydown ng
发布时间:2020-12-17 10:35:03 所属栏目:安全 来源:网络整理
导读:html: input type="text" ng-model="employee.account" ng-keydown / js: /*directives*/angular.module('activitiModeler').directive('ngKeydown',function() { return { restrict: 'A',link: function(scope,elem,attrs) { //var functionToCall = scope.
html:
<input type="text" ng-model="employee.account" ng-keydown /> js: /*directives*/ angular.module('activitiModeler').directive('ngKeydown',function() { return { restrict: 'A',link: function(scope,elem,attrs) { //var functionToCall = scope.$eval(attrs.ngKeydown); elem.on('keydown',function(e){ alert(e+','+e.which); }); } }; }); /*directives*/ angular.module('activitiModeler').directive('ngKeydown',attrs) { //var functionToCall = scope.$eval(attrs.ngKeydown); elem.on('keyup',function(e){ alert(scope.employee.account); }); } }; }); (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |