We can find which key is pressed using keypress event. Pass $event to the function. We can track the pressed key using $event.keyCode. Read about key codes over here

Type Here <br/>
<input type="number" ng-keypress="whichKey($event)"/>
function myCtrl($scope, $compile) {
    $scope.whichKey = function($event) {
       if($event.keyCode == 13) {
         alert('Enter pressed');
       } else if($event.keyCode == 8) {
         alert('Backspace pressed');         
       } else if($event.keyCode == 9) {
         alert('Tab pressed');         
       } else if($event.keyCode == 32) {
         alert('space pressed');         
       } else {

1 comment:

  1. Good blog. Keep sharing. I love them Are you also searching for Cheap assignment help? we are the best solution for you. We are best known for delivering cheap assignments to students without having to break the bank



Popular Posts