<h1>Example: ngKeypress</h1>
<p>ngKeypressはkeypressイベントをリスナー登録します。</p>
<div ng-app="myApp">
<div ng-controller="myController">
<input type="text" ng-keypress="keypress()">
<p>
Keypress: {{ keyPressCount }}
</p>
</div>
</div>
@import "bourbon";
body {
padding: 1.5rem;
}
View Compiled
var app = angular.module('myApp', []);
app.controller('myController', ['$scope', function($scope){
$scope.keyPressCount = 0;
$scope.keypress = function(){
$scope.keyPressCount++;
}
}]);
This Pen doesn't use any external CSS resources.