Having some trouble implementing Checkbox functionality, I'm having difficulty determining which checkboxes the user has selected. How can this be achieved? Here's a look at my HTML snippet:
<td>
<table border="0"><th>Tier</th>
<tr ng-repeat="item in tiertype">
<td>
<label class="checkbox" for="{{item.id}}">
<input type="checkbox" ng-model="selection.ids[item.id]" name="tier_class" ng-checked="item.checked" id="{{item.id}}"/>{{item.name}}
</label>
</td></tr></table>
</td>
And here is my javascript snippet:
$scope.tiertype = [
{ id: 1, name: "All", checked: true},
{ id: 2, name: "Standard", checked: false },
{ id: 3, name: "Unreserved", checked: false },
{ id: 3, name: "Reserved", checked: false },
{ id: 4, name: "General", checked: false }
];
When using "check box value= {{selection.ids}}", I'm not receiving the correct values. Furthermore, when checking any checkbox, they all seem to get checked or only the checkbox with id:1 (default). It's puzzling to me and I'm struggling to understand where I'm making mistakes since I have limited experience with AngularJS.