I have a ng-table in my webapp with a lot of rows per page (up to 1000). I also have a select-all checbox that call a function ng-change to set the flag selected to true in each table row. The function require some seconds to be executed so user can click two or more time on the checkbox and i want to prevent this. I would like to disable the checkbox while the function is executed. Is it possible to do this? Thanks
2 Answers
perhaps you can create some marker for ng-disable. like this:
<input type="checkbox" ng-disabled="inProgress">
and in controller when treated your function add this marker:
$scope.runYourFunction = function() {
$scope.inProgress = true;
....... your function ........
$scope.inProgress = false; // in the end. it will enabled your checkboxes;
}
2 Comments
Davide Campello
Thanks for answer, the problem is that I'll see the checbox disabled only once the function is ended and if i click two times on checkbox the function will be executed two times
Dustin Hodges
@DavideCampello The first thing that runYourFunction does above is set $scope.inProgress = true to disable your checkbox. It then does the function call that will take several seconds. Seems to be exactly what you need