1

On button click I wan't to disable all buttons to prevent any other operation. For this I use request.isProcessing bool value. In the beginning function approve(request) I set request.isProcessing to true and In the end to false.

But this doesn't work. (For request in ng-repeat request.isProcessing doesn't change)

Is it because I am in different scope or what?

<div class="one-third" ng-repeat="request in pendingRequests track by request.id">
   ...
   <div class="button-container">
       <button ng-click="approve(request);" ng-disabled="request.isProcessing" class="btn btn-primary">Confirm<i ng-hide="request.isProcessing" class="fa fa-check"></i><span ng-show="request.isProcessing" class="spinner no-hover"><a><i class="fa-li fa fa-spinner fa-spin"></i></a></span></button>
       <button ng-click="reject(request);" ng-disabled="request.isProcessing" class="btn btn-default pull-right" am-hide-request-resolve-div>Reject <i ng-hide="request.isProcessing" class="fa fa-times"></i><span ng-show="request.isProcessing" class="spinner no-hover"><a><i class="fa-li fa fa-spinner fa-spin"></i></a></span></button>
   </div>
</div>

$scope.approve = function (request) {
        request.isLoading = true;
        //functionality of approving
        request.isLoading = false;
}
georgeawg
  • 48,608
  • 13
  • 72
  • 95
demo
  • 6,038
  • 19
  • 75
  • 149

1 Answers1

2

In the javascript your variable is isLoading while in your HTML the variable is isProcessing. SO i guess you should rename one of them.

Walfrat
  • 5,363
  • 1
  • 16
  • 35