AngularJS ng-keyup 指令
定义和用法
ng-keyup
指令向 AngularJS 告诉在特定 HTML 元素上使用键盘时应执行的操作。
AngularJS ng-keyup
The directive will not override the original onkeyup event of the element, both of which will be executed.
The order of keystrokes is:
- Keydown (keyboard press down)
- Keypress (keyboard press)
- Keyup (keyboard 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. |