So I have javascript code that checks how much checkboxes is checked. It works well except that when I hit 4 checkboxes it disables all checkboxes not only unchecked (you can see it on image below). Thank you!
JAVASCRIPT
$scope.checkedb= function (unit, device, unitt){
unitt.showcb = !unitt.showcb;
numOfCh = 0;
for (var i = 0 ; i < unit.length; i ++){
if (unit[i].showcb == true){
numOfCh ++;
}
if (numOfCh > 3){
device.selectedf = true;
}
}
}
HTML
<div ng-repeat="unit in data[unitIndex].units" ng-if="unit.users_ID == tvw.id">
<td class="footable-visible" >
<input type="checkbox" ng-disabled="device.selectedf" ng-click="checkedb(data[unitIndex].units, device, unit)">
</td>
</div>
as you can see the checked checkboxes are also disabled.
Aucun commentaire:
Enregistrer un commentaire