 
  Data Structure Data Structure
 Networking Networking
 RDBMS RDBMS
 Operating System Operating System
 Java Java
 MS Excel MS Excel
 iOS iOS
 HTML HTML
 CSS CSS
 Android Android
 Python Python
 C Programming C Programming
 C++ C++
 C# C#
 MongoDB MongoDB
 MySQL MySQL
 Javascript Javascript
 PHP PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
AngularJS – ng-copy Directive
The ng-copy Directive in AngularJS is used for specifying any custom behaviour while copying the texts in input text fields. We can use this directive to call certain methods that will be triggered while the text is copied from the input field. This directive is supported by all types of input elements.
Syntax
<element ng-copy="expression">..content..</element>
Example − ngCopy Directive
Create a file "ngCopy.html" in your Angular project directory and copy-paste the following code snippet.
<!DOCTYPE html> <html>    <head>       <title>ngCopy Directive</title>       <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.9/angular.min.js"></script>       <style>          .index {color: white; background-color: green;}       </style>    </head>    <body ng-app style="text-align: center;">       <h1 style="color: green;">          Welcome to Tutorials Point       </h1>       <h2>          AngularJS | ngCopy Directive       </h2>       <div ng-init="isCopy=false; copy='Copy this text!'">          <textarea ng-copy="isCopy=true" ng-model="copy"> </textarea>          <br />          <pre>Copied status: {{isCopy}}</pre>       </div> </body> </html> Output
To run the above code, just go to your file and run it as a normal HTML file. You will see the following output on the browser window.
Advertisements
 