ANGULARJS Basic Ng-paste Instruction Simple example _angularjs

Source: Internet
Author: User


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!


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.