AngularJS ng-keyup directive
AngularJS instance
Code executed when the key is released:
<!DOCTYPE html><html><head><meta charset="utf-8"><script src="http://apps.bdimg.com/libs/angular.js/1.4.6/angular.min.js"></script></head><body ng-app=""><input ng-keyup="count = count + 1" ng-init="count=0" /><h1>{{count}}</h1><p>This instance will automatically add 1 to the calculation variable "count" every time the key is released in the input box. </p></body></html>Definition and usage
The ng-keyup directive is used to tell AngularJS what to do when the key is released on the specified HTML element.
The ng-keyup directive will not overwrite the element's native onkeyup event. When the event is triggered, both the ng-keyup expression and the native onkeyup event will be executed.
The sequence of events of keystrokes:
1.Keydown
2.Keypress
3.Keyup
grammar
<element ng-keyup="expression"></element>
<input>, <select>, <textarea>, and other editable elements support this directive.
Parameter value
| value | describe |
|---|---|
| Expression | Press the key to release the executed expression. |
The above is the information sorting out the AngularJS ng-keyup instruction, and will be added later!