Ng-Mousedown-7

 

Ng-Mousedown-7

 
 
 
<!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> <link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css"> </head> <body ng-app="app"> <div ng-controller="myController"> <div class="container"> <div class="row text-center"> <div class="col-md-12"> <br /> <button ng-disabled="load" ng-mousedown="getData()" class="btn btn-success">Mousedown to load data</button> <br /> <br /> <div> <img ng-show="loading" height="200" width="200" src="http://learnit.visrosoftware.com/datafiles/loading (1).gif" /> <div ng-show="load"> <p> LearnIT is a website for Beginner and Professional to learn AngularJS step by step and the biggest advantage is that while learning you can experiment your code Online. </p> <p>Contact Us</p> <p>info@visrosoftware.com </p> <p>Panchkula, India</p> </div> </div> </div> </div> </div> </div> <script> var app = angular.module("app", []); app.controller('myController', ['$scope', '$timeout', function ($scope, $timeout) { $scope.loadData = function () { $scope.loading = false; $scope.load = true; }; $scope.getData = function () { $scope.loading = true; $timeout(function () { $scope.loadData(); }, 3000); }; }]); </script> </body> </html>
Output