Skip to content Skip to sidebar Skip to footer

Keycode Displaying Incorrect Code Value In Angularjs

I'm working on capturing keys pressed to use with an API for fuzzy search results. Anyways I'm using this code to capture keypresses in my Markup and Directive Controller:

Solution 1:

I think what you're looking for is ng-keyup instead, this will work for you:

<input type="text"
       placeholder="Search"
       ng-click="searchPop($event)"
       ng-keyup="typingMainSearch($event)">

According to Mozilla the keyCode property of keypress is deprecated.

Also - this is why you saw 97 when clicking 'a' for instance (taken from the Mozilla link):

The Unicode reference number of the key;

You can find the unicode numbering table here.

Post a Comment for "Keycode Displaying Incorrect Code Value In Angularjs"