Ng Ng Keypress
π
2026-06-20 | π Angular
# AngularJS `ng-keypress` Directive
[ AngularJS Reference](#)
* * *
## AngularJS Example
Code executed when a key is pressed:
{{count}}
[Try it Β»](#)
* * *
## Definition and Usage
The **ng-keypress** directive tells AngularJS what to do when a key is pressed on a specified HTML element.
The **ng-keypress** directive does not override the element's native onkeypress event. When the event triggers, both the **ng-keypress** expression and the native onkeypress event will execute.
The order of key press events:
1. Keydown
2. Keypress
3. Keyup
* * *
## Syntax
The ``, ``, `