AngularJS | ng-paste Directive
The ng-paste Directive in AngularJS is used to specify custom behavior functions when the text in input fields is pasted into an HTML element. It can be used to call a function which will be triggered when the text is pasted into the input field. It is supported by <input>, <select> and <textarea>.
Syntax:
<element ng-paste="expression"> Content ... </element>
Where expression tells what to do when the input is pasted into an HTML element.
Example:
<!DOCTYPE html> <html> <head> <title>ng-paste Directive</title> <script src= </script> </head> <body ng-app style="text-align:center"> <h1 style="color:green">GeeksforGeeks</h1> <h2>ng-paste Directive</h2> <div ng-init="ispaste=false;paste='Paste some text!'"> <textarea ng-paste="ispaste=true" ng-model="paste"> </textarea> <br /> <pre>Paste status: {{ispaste}}</pre> </div> </body> </html> |
Output:
Before paste:

After paste:

Recommended Posts:
- AngularJS | ng-app Directive
- AngularJS | ng-if Directive
- AngularJS | ng-jq Directive
- AngularJS | ng-src Directive
- AngularJS | ng-cut Directive
- AngularJS | ng-value Directive
- AngularJS | ng-csp Directive
- AngularJS | Directive
- AngularJS | ng-selected Directive
- AngularJS | ng-required Directive
- AngularJS | ng-srcset Directive
- AngularJS | ng-readonly Directive
- AngularJS | ng-blur Directive
- AngularJS | ng-bind Directive
- AngularJS | textarea Directive
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.


