Home
Tutorials
Microsoft Technologies Tutorials
Java Programming Tutorials
Web Designing Tutorials
Script Programming Tutorials
Database Programming Tutorials
Mobile Technologies Tutorials
Other Programming Tutorials
Examples
Articles
Tools
News
AngularJS ng-keypress Event Example
Keywords : Angularjs keypress event example, Angularjs ng-keypress directive example, Angularjs keypress on div example, Keypress event example in angularjs, How to use ng-keypress event in angularjs
Example
<!DOCTYPE html> <html> <head> <title> AngularJs ng-keypress Event with Example </title> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script> <script type="text/javascript"> var app = angular.module('ngkeypressApp', []); app.controller('ngkeypressCtrl', function ($scope) { $scope.getkeys = function (event) { $scope.keyval = event.keyCode; } }); </script> </head> <body> <div ng-app="ngkeypressApp" ng-controller="ngkeypressCtrl"> <h2>AngularJS ng-keypress Event Example</h2> Enter Text: <input type="text" ng-keypress="getkeys($event)" ng-model="ftxt"><br /><br /> <span style="color:Red">Last Key Code: {{keyval}}</span> </div> </body> </html>
Click Here to See Result
Result
Previous
Next