AngularJS ng-keydown
Directive
AngularJS Example
Code to execute when a key is pressed:
Definition and Usage
The ng-keydown directive is used to tell AngularJS what to do when a key is pressed on a specified HTML element.
The ng-keydown directive does not override the element's native onkeydown event. When the event is triggered, both the ng-keydown expression and the native onkeydown event will be executed.
The sequence of key events:
- Keydown
- Keypress
- Keyup
Syntax
The directive is supported by <input>, <select>, <textarea>, and other editable elements.
Parameter Values
Value | Description |
---|---|
expression | The expression to execute when a key is pressed. |