I have a piece of HTML code with ng-repeat that includes checkboxes.
<table>
<tr ng-repeat="address in contactInfo.Addresses">
<td>{{address.DisplayType}}</td>
<td>{{address.AddressLine1}}</td>
<td>{{address.AddressLine2}}</td>
<td>{{address.City}}</td>
<td>{{address.State}}</td>
<td>{{address.Zip}}</td>
<td>
<input type="checkbox" ng-model="address.ClientDefault" ng-checked="{{address.ClientDefault}}" ng-click="updateAddressSelection($index, contactInfo.Addresses)" />
</td>
<td><i class="fa fa-envelope-square"></i></td>
</tr>
</table>
After running the updateAddressSelection function:
$scope.updateAddressSelection = function(position, address) {
angular.forEach(address, function(address, index) {
if (position != index) {
address.ClientDefault = false;
}
});
};
The issue arises when trying to remove the originally checked checkbox upon click. The JSON object being repeated is structured as follows:
{
"ID": 6,
"DisplayType": "Other",
"AddressLine1": "123 test st",
"AddressLine2": "",
"City": "madeupville",
"State": "MO",
"Zip": "63123",
"AddressType": 3,
"Linked": 0,
"ClientDefault": "true",
"HouseholdDefault": 0
}
If you have suggestions on how to clear the default checkbox on click, please advise. Apart from this issue, everything else functions correctly.