AngularJS ng-cut directive
AngularJS instance
Execute expressions when the text of the input box is cut:
<!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-cut="count = count + 1" ng-init="count=0" value="Cut this text" /><p>The text was cut {{count}} times. </p><p>The count variable "count" in the instance is automatically increased by 1 after each clipping. </p></body></html>Note: The count variable "count" in the instance is automatically increased by 1 after each clipping.
Definition and usage
The ng-cut directive is used to tell AngularJS what to do when cutting HTML elements' text.
The ng-cut directive directive will not overwrite the element's original oncut event. When the event is triggered, both the ng-cut expression and the original oncut event will be executed.
grammar
<element ng-cut="expression"></element>
<a>, <input>, <select>, <textarea>, and window objects all support this directive.
Parameter value
| value | describe |
|---|---|
| Expression | An expression executed when the element text is cut. |
The above is a compilation of the AngularJS ng-cut instruction. I hope it can help students who program Angular.