Angularjs Examples

AJS Examples


AngularJS ng-KeyPress Directive

The AngularJS ng-keypress directive is used to attach specific functionality on keypress event.

Syntax

<button ng-keypress="addFunctionality"> 

AngularJS ng-KeyPress Directive Example

<html ng-app>
<head>
<script src= "http://ajax.googleapis.com/ajax/libs/angularjs/1.2.26/angular.min.js"></script>
</head>
<body>
<input ng-keypress="count = count + 1" ng-init="count=0">
    key down count: {{count}}
</div>
</body>
</html>
See Live Example