Skip to content
Related Articles

Related Articles

Improve Article
Save Article
Like Article

AngularJS | ng-paste Directive

  • Last Updated : 28 Mar, 2019

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>.

 <element ng-paste="expression"> Content ... </element> 

Where expression tells what to do when the input is pasted into an HTML element.

<!DOCTYPE html>
        <title>ng-paste Directive</title>
        <script src=
    <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">
            <br />
            <pre>Paste status: {{ispaste}}</pre>

Before paste:
After paste:

My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!