angularjs中回车键触发某一事件的方法

要求:在输入框中输入值以后,按回车键触发某一事件的执行

html:

<input id="input" name="input" ng-model="querykdUser.page.pageSize" ng-keyup="myKeyup($event)" class="form-control" style="width:60px;"> 

js:

$scope.myKeyup = function(e){

 //IE 编码包含在window.event.keyCode中,Firefox或Safari 包含在event.which中
var keycode = window.event?e.keyCode:e.which; 
    if(keycode==13){
    $scope.showkdUsers();
    }
};

回车键:13

左箭头键:37

右箭头键:39

以上这篇angularjs中回车键触发某一事件的方法就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持来客网。