AngularJS ng-copy Directive Last Updated : 08 Aug, 2022 Comments Improve Suggest changes Like Article Like Report The ng-copy Directive in AngularJS is used to specify the custom behavior functions during the copy of the text in input text fields. It can be used when we want to call a function that will be triggered when the text is copied from the input field. It is supported by all input elements. The element's original oncopy event will not be overridden with the ng-copy directive when both are executing. Syntax: <element ng-copy="expression"> Contents... </element>Parameter: expression: It specifies what to do when the element is copied.Example 1: This example uses the ng-copy Directive to display a message when an element will copy. HTML <!DOCTYPE html> <html> <head> <title>ng-copy Directive</title> <script src= "https://ajax.googleapis.com/ajax/libs/angularjs/1.4.2/angular.min.js"> </script> <style> body { text-align: center; font-family: sans-serif; } h1 { color: green; } </style> </head> <body ng-app=""> <h1>GeeksforGeeks</h1> <h2>ng-copy 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: Example 2: This example describes the use of the ng-copy Directive in AngularJS where it specifies that the number of times the given text will be copied, its total count will be displayed accordingly. HTML <!DOCTYPE html> <html> <head> <title>ng-copy Directive</title> <script src= "https://ajax.googleapis.com/ajax/libs/angularjs/1.6.9/angular.min.js"> </script> <style> body { text-align: center; font-family: sans-serif; } h1 { color: green; } </style> </head> <body ng-app=""> <h1>GeeksforGeeks</h1> <h2>ng-copy Directive</h2> <p>Copy the "GeeksforGeeks" text</p> <input ng-copy="copy = copy + 1" ng-init="copy=0" value="GeeksforGeeks" /> <p> {{copy}} times text copied.</p> </body> </html> Output: Comment More infoAdvertise with us Next Article AngularJS ng-copy Directive V Vishal Chaudhary 2 Follow Improve Article Tags : Web Technologies AngularJS AngularJS-Directives Similar Reads AngularJS ng-app Directive The ng-app Directive in AngularJS is used to define the root element of an AngularJS application. This directive automatically initializes the AngularJS application on page load. It can be used to load various modules in AngularJS applications. The ng-app directive declares only once in the HTML doc 1 min read AngularJS ng-cut Directive The ng-cut Directive in AngularJS is used to specify the custom behavior functions when the text in input fields is cut. It can be used when we want to call a function that will be triggered when the text is cut from the input field. It is supported by all input elements. Syntax: <element ng-cut= 2 min read AngularJS ng-click Directive The ng-click Directive in AngluarJS is used to apply custom behavior when an element is clicked. It can be used to show/hide some element or it can pop up an alert when the button is clicked. Syntax: <element ng-click="expression"> Contents... </element>Parameter Value: expression: It sp 2 min read AngularJS ng-class Directive The ng-class Directive in AngularJS is used to specify the CSS classes on HTML elements. It is used to dynamically bind classes on an HTML element. The value for the ng-class has either string, an object, or an array. It must contain more than one class name, which is separated by space, in the case 2 min read AngularJS ng-change Directive The ng-change Directive in AngularJS is used whenever the value of an input element changes. The expression is evaluated immediately whenever there is a change in the input value. It requires an ng-model directive to be present. It is triggered whenever there is any single change in the input. It ca 2 min read Like