SoFunction
Updated on 2025-04-04

AngularJS basic ng-cut instruction introduction and simple examples

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="/libs//1.4.6/"></script>
</head>
<body ng-app="">

<input ng-cut="count = count + 1" ng-init="count=0" value="Cut this text" />

<p>The text is cut {{count}} Second-rate。</p>

<p>Count variables in the instance "count" 在每Second-rate剪切后自动增加 1。</p>

</body>
</html>

Notice:The count variable "count" in the instance is automatically increased by 1 after each shear.

Definition and usage

ng-cut Directives are used to tell AngularJS what to do when cutting text from HTML elements.

ng-cutDirectives will not overwrite the original oncut event of an element. 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.