I encountered a challenge with ng-repeat while incorporating ng-checked and ng-disable alongside it.
<div ng-repeat="module in modulelist">
<input id="switch{{$index}}" ng-init="setState($index);" type="checkbox" ng-checked="switch.checked" ng-disabled="switch.disable" ng-click="toggle($index, light.name)" />
Using ng-init to retrieve the state of the checkbox module.status
from modulelist. The status can be ON, OFF, or unknown. I want to disable the checkbox for 'unknown' status, and check/uncheck it for 'ON/OFF'. I attempted using:
$scope.switch = {checked: true};
However, this property is being applied to all checkboxes. I understand that 'switch.checked'/'switch.disable' should be unique for each checkbox to make individual changes, but I am struggling to achieve this.
Please assist.