ng-mousedown

What is ng-mousedown:ng-mousedown used to perform any task on mouse down event.
Description of ng-mousedown:ng-mousedown has 0 priority . perform any particulate task on ng-mouse down.
Syntax of ng-mousedown:
<div ng-mousedown="myfun()"></div>
Or
<div ng-mousedown="msg='This is angularjs example of ng-mousedown"></div>.
How to Use ng-mousedown/ng-mousedown Example::
Example1:
<div ng-init="msg='angularjs example'">
    msg1:{{msg}}
    <div ng-mousedown="msg='This is angularjs example of ng-mousedown'">
        msg2:{{msg}}
    </div>
</div>
o/p: msg:angularjs example
  //when ng-mousedown fire
     msg:This is angularjs example of ng-mousedown
Example2:

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

   o/p: Before ng-mousedown fired: Angularjs Example of ng-mousedown.

            After ng-mousedown fired :This is angularjs example of ng-mousedown.

No comments :

Post a Comment