加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

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);
             });
        }
    };
});

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读