AngularJS中文社区为什么在input上加上ng-keydown无效
1个回答
展开全部
试一下我这个例子:
<!DOCTYPE html>
<html ng-app="test">
<head>
<title>KEYDOWN</title>
</head>
<body ng-controller="IptCtrl">
<input type="text" ng-keydown="keyDownFn($event)">
<div>keyCode:{{keyCode}}</div>
<script type="text/javascript" src="./angular.min.js"></script>
<script>
var app = angular.module('test', []);
app.controller('IptCtrl', ['$scope',function($scope){
$scope.keyDownFn = function(event){
console.log(event);
$scope.keyCode = event.keyCode;
}
}]);
</script>
</body>
</html>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询