I am trying to bind an array of objects to sets of radio button groups. I have it to the point where it generates the groups based on the model and pre-selects the correct radio button based on the boolean selected, however I cannot figure out how to toggle the value of the bound item to true and false when the radio button value changes. Basically, I would like these to function like mutually exclusive checkboxes. I could probably do this with actual checkboxes, but obviously radio buttons are ideal, as this is their intended purpose.
JSFiddle for your convenience: http://jsfiddle.net/uv9mwkwd/5/
HTML:
<div ng-app ng-controller="Extensions">
<div ng-repeat="propertyGroup in propertyGroups">
{{propertyGroup.label}}
<div ng-repeat="prop in propertyGroup.properties">
<input type="radio" ng-model="prop.selected" name="prop{{propertyGroup.alias}}" ng-value="true" /> {{prop.value}}
</div>
</div>
</div>
Script:
function Extensions($scope) {
$scope.propertyGroups = [
{'label': 'Property 1',
'alias': 'property1',
'properties': [{value: 'Value 1', selected: true},{value: 'Value 2', selected: false}]},
{'label': 'Property 2',
'alias': 'property2',
'properties': [{value: 'Value 1', selected: false},{value: 'Value 2', selected: true}]}
];
console.debug($scope.propertyGroups);
}