AngularJS ng-keyup directive
Definition and Usage
ng-keyup
The instruction tells AngularJS what operations to perform when using the keyboard on a specific HTML element.
of AngularJS ng-keyup
Directives do not override the original onkeyup event of the element, both will be executed.
The order of keystrokes is:
- Keydown (key press down)
- Keypress (key press)
- Keyup (key release)
Example
Execute an expression each time a key is pressed:
<input ng-keyup="count = count + 1" ng-init="count=0" /> <h1>{{count}}</h1>
Syntax
<element ng-keyup="expression</element>
Support <input>
,<select>
,<textarea>
and other editable elements.
Parameters
Parameters | Description |
---|---|
expression | An expression to be executed when the key is completed. |