Introduction and Simple Example of AngularJS Basic ng cut Instructions

  • 2021-07-06 10:09:39
  • OfStack

AngularJS ng-cut Directive

AngularJS instance

Execute the expression 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 has been cut  {{count}}  Times. </p>

<p> Count variables in an instance  "count"  Automatically increases after each cut  1 . </p>

</body>
</html>

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

Definition and usage

The ng-cut directives are used to tell AngularJS what to do when cutting the text of an HTML element.

The ng-cut directive does not override the element's original oncut event, and when the event is fired, both the ng-cut expression and the original oncut event are executed.

Grammar

< element ng-cut="expression" > < /element >

< a > , < input > , < select > , < textarea > And window objects support this directive.

Parameter value

描述
expression 元素文本被剪切时执行的表达式。

The above is the AngularJS ng-cut instruction data collation, hoping to help students programming Angular.


Related articles: