In my project, ng-keypress does not work for "Enter Key" from all places. From some places it works fine, but from other places it works for all keys except "Enter Key".
Here I call the test () method on ng-keypress.
<div class="actions">
<div class="ui approve button red" data-ng-click="test()" id="confirm-yes" tabindex="8" ng-keypress="test()">Yes</div>
<div class="ui cancel button" data-ng-click="test()" id="confirm-no" tabindex="7" ng-keypress="test()">Cancel</div>
</div>
From the test method, I just show the key code. I could see the keyboard code correctly for all other keystrokes except Enter.
$scope.test = function () {
alert('test called'+event.keyCode);
}
I have looked through many StackOverflow articles and I am sure that its syntax is correct, but I am completely confused by its strange behavior.
Any idea why ng-keypress doesn't work for input and works for all other keys.
source
share