Tuesday, 3 November 2015

ng-paste

What is ng-paste:ng-paste used to perform any task when paste something form where ng-paste mentioned.
Description of ng-paste:ng-paste has 0 priority . We can perform any particulate task when we paste something on Browser window ,input,select,textarea and anchor.
Syntax of ng-paste:
<elementname  ng-paste="myfun()"></elementname>
    OR

    <input ng-paste="myfun()"/>
How to Use ng-paste/ng-paste Example::
    AngularJs Example 1:
    <div>
        Angularjs Example of ng-paste
        <br />
        <div ng-init="myexpression='Angularjs Example of ng-paste'">
            <input type="text" ng-paste="myfun()" /> This is angularjs example of ng-paste
        </div>
    </div>
    o/p:   Angularjs Example of ng-paste
    This is angularjs example of ng-paste


    AngularJs Example 2:

    <div ng-app="webapp">
        <div ng-controller="angularjsexampleCtlr">
            <div>
                Angularjs Example of ng-paste
                <br />
                <div ng-init="myexpression='Angularjs Example of ng-paste'">
                    Before paste  : {{myexpression}}
                    <input type="text" ng-paste="myfun()" />
                    After paste  :{{myexpression}}
                </div>
            </div>
        </div>
    </div>
    <script>
        angular.module('webapp', []).controller('angularjsexampleCtlr', function ($scope, $http) {
            $scope.myfun = function () {
                $scoep.myexpression = 'This is angularjs example of ng-paste after paste;
            }
        });
    </script>

        o/p: Before paste : Angularjs Example of ng-paste.
                After paste  :This is angularjs example of ng-paste after paste .

No comments :

Post a Comment