Angularjs ng-paste Instruction
Angularjs instance
Executes an expression when text is pasted:
<! 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-paste = "count = count + 1" ng-init = "count = 0" value = "Paste text here!" />
<p> Text {{count}} pasted. </ p>
<p>
This example demonstrates that when the text is pasted in the input box, the calculation variable "count" will automatically increase by one. </ p>
</ body>
</ html>
Definitions and usage
The ng-paste directive is used to tell the Angularjs text what to do when it is pasted on an HTML element.
The ng-paste directive does not overwrite the native Onpaste event of the element, and the ng-paste expression and the native Onpaste event are executed when the event is triggered.
Grammar
<element ng-paste= "expression" ></element>
<input>, <select>, <textarea> and other editable elements support the directive.
Parameter values
value |
Description |
Expression |
The expression on which the text is pasted onto an element. |
The above is the Angularjs ng-paste instructions of the basic data collation, follow-up continue to supplement the relevant information, thank you for your support!