Ng-Mousedown-1

 

Textbox value show below because it is bind to name variable.When we mouse down(click) on the ng-mousedown text it will display the alert.

 
 
 
<!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title></title> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.2/angular.min.js"></script> </head> <body ng-app="app"> <div ng-controller="controllerName"> Your name: <input type="text" ng-model="name" /> <hr /> <p ng-mousedown="name='World'">Hello {{name || "World"}}!</p> <div style="border:1px solid red;" ng-mousedown="alert()"> ng-mousedown </div> </div> <script> var app = angular.module("app", []); app.controller('controllerName', ['$scope', function ($scope) { $scope.alert = function () { alert("Example of ng-mousedown."); } }]); </script> </body> </html>
Output