How to get an array of checkboxes in Angular JS?
1 answer
Try the following:
<div ng-controller="MyCheckbox"
ng-init="checkboxes = {1: true, 2: false, 3: true, 4: false}">
<input type="checkbox" ng-model="checkboxes.1">1
<input type="checkbox" ng-model="checkboxes.2">2
<input type="checkbox" ng-model="checkboxes.3">3
<input type="checkbox" ng-model="checkboxes.4">4
<br>{{checkboxes}}
</div>
+1
source to share