AngularJs ng-mousedown events

AngularJs ng-mousedown events

The AngularJs ng-mousedown is use to specify the mousedown event features.

The demo link click to view http://embed.plnkr.co/a1EUDA/preview

The HTML code-sample:

<button type="button" ng-mousedown="mousedown(IsDisplay)">NG-MOUSEDOWN</button>

The AngularJs code-sample:

var app = angular.module('myApp', []);
app.controller('ngMousedownCtrl', ["$scope", function ($scope) {
    $scope.domain = "code-sample.com";
    $scope.IsDisplay = false;
    $scope.mousedown = function (clicked) {
        alert("My mousedown function is called.");
        $scope.IsDisplay = clicked == true ? false : true;
    };
}]);

The AngularJs and HTML code-sample:

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <title>angularjs ng-mousedown</title>
    <script src="https://code.angularjs.org/1.4.1/angular.js"></script>
    <script>
    var app = angular.module('myApp', []);
    app.controller('ngMousedownCtrl', ["$scope", function ($scope) {
        $scope.domain = "code-sample.com";
        $scope.IsDisplay = false;
        $scope.mousedown = function (clicked) {
            alert("My mousedown function is called.");
            $scope.IsDisplay = clicked == true ? false : true;
        };
    }]);
    </script>
</head>
<body ng-app="myApp">
    <div ng-controller="ngMousedownCtrl">
        <div><h2>The ng-mousedown in AngularJs</h2> </div>
        <div>
            Domain name: <input type="text" ng-model="domain"> <button type="button" ng-mousedown="mousedown(IsDisplay)">NG-MOUSEDOWN</button>
        </div>
        <div>
            <div ng-show="IsDisplay"> My mousedown function is called. <br /><h3 style="color:green;">Display User detail: {{domain}} </h3></div>
        </div>
    </div>
</body>
</html>

The output link:  http://embed.plnkr.co/a1EUDA/preview



Thank you!



ANIL SINGH

Anil Singh is an author, tech blogger, and software programmer. Book writing, tech blogging is something do extra and Anil love doing it. For more detail, kindly refer to this link..
My Blogs - https://code-sample.com and https://code-sample.xyz
My Book1 - BEST SELLING ANGULAR BOOK (INCLUDING ALL VERSIONS 2, 4, 5, 6, 7)
My Book2 - ANGULAR 2 INTERVIEW QUESTIONS BOOK - Both Books are Available on WorldWide.

www.code-sample.com/. Powered by Blogger.