Ng-Mousedown-5

 

On ng-mousedown event it will display alert with textbox value because textbox is bind to mouseDown variable.

 
 
 
<!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"> Mouse Down: <input type="text" ng-mousedown="alert()" ng-model="mouseDown" /> </div> <script> var app = angular.module("app", []); app.controller('controllerName', ['$scope', function ($scope) { $scope.mouseDown = 'LearnIt'; $scope.alert = function () { alert($scope.mouseDown); } }]); </script> </body> </html>
Output