Alex Kumbhani Alex Kumbhani - 1 month ago 10
Javascript Question

how to disable mouse click when progress-bar is loading?

i create one page app in angular . i want when my progress-bar load at that time i want to load some CSS for disable work.
so, how i can do this?i create one page app in angular .
i use this code for load progress-bar

.config(['cfpLoadingBarProvider', function (cfpLoadingBarProvider) {
cfpLoadingBarProvider.includeSpinner = true;
cfpLoadingBarProvider.includeBar = true;
}])


and i want that when this load at that time disable mouse click event.

Answer

I am considering here a button disable after click..

function myCtrl($scope) {

   $scope.disable=false;

   $scope.btnClick=function(){
       $scope.disable=true;

       $http.post('apiURL').then(function(response){
         if( response!=null && response.data.error != null){
             //error
             alert('Error');
             $scope.disable=false;
         }else{
             //success
             $scope.data=response.data; 
             $scope.disable=false;
         }
    });
   };
}

<div ng-app ng-controller="myCtrl">
    <button ng-disabled="disable==true" ng-click="btnClick()">Submit</button>
</div>

From this example you'll get some idea of disabling items..

Comments