In this example of Ng-Keydown, We have added validation on key down of text boxes. Textbox is used to get the age of user so if user will enter value other then numeric then that will be invalid value. So we added validation on textbox keydown using Ng-Keydown

<!DOCTYPE html> <html xmlns=""> <head> <title>Welcome to LearnKode - A code learning platform</title> <script src=""></script> </head> <body ng-app="app"> <div ng-controller="myController"> <h3>Numeric TextBox Validation on Keydown</h3> Age: <input type="text" ng-keydown="isNumeric($event)" /> </div> <script> var app = angular.module("app", []); app.controller('myController', ['$scope', function ($scope) { $scope.isNumeric = function (e) { if (!((e.keyCode >= 48 && e.keyCode <= 57) || (e.keyCode >= 96 && e.keyCode <= 105) || (e.keyCode == 8))) { return e.preventDefault(); } } }]); </script> </body> </html>