Εντολή ng-keydown του AngularJS
Ορισμός και χρήση
ng-keydown
Η εντολή ενημερώνει το AngularJS για τις ενέργειες που πρέπει να εκτελεστούν όταν χρησιμοποιείται το πλήκτρο της κλειδαριάς στο συγκεκριμένο στοιχείο HTML.
Of AngularJS's ng-keydown
Directives do not override the original onkeydown event of the element, both will be executed.
The order of keystrokes is:
- Keydown (Keyboard Pressed)
- Keypress (Keyboard Press)
- Keyup (Keyboard Release)
Example
Execute an expression each time a key is pressed:
<input ng-keydown="count = count + 1" ng-init="count=0" /> <h1>{{count}}</h1>
Syntax
<element ng-keydown="expression</element>
Support <input>
,<select>
,<textarea>
and other editable elements.
Parameters
Parameters | Description |
---|---|
expression | The expression executed when the key is pressed. |