单击按钮时,我不想禁用所有按钮以防止任何其他操作。为此,我使用request.isProcessing
布尔值。一开始function approve(request)
我设置request.isProcessing
为true
,最后设置为false
。
但这不起作用。(对于 ng-repeat 中的请求request.isProcessing
不会改变)
是因为我在不同的scope
地方还是什么?
<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;
}