I am new to AngularJS and facing one problem with multiple check-boxes. I have one registration form in which I have choices of colors which comes from database.
$scope.ColorList = { { ID: 1,Name:"Red" },{ ID: 2,Name:"Green" },{ ID: 3,Name:"Blue" }};
I am using below code to render checkbox in form.
<tr>
<td>Favorite Colors</td>
<td>
<label data-ng-repeat="c in item.ColorList">
<input type="checkbox" value="{{c.ID}}" /><span>{{c.Name}}</span>
</label>
</td>
</tr>
Now, during add operation, checkboxes renders properly... But how to bind checkboxes with model so that I get an array of selected checkboxes?
Also during edit time, I need to pre-select checkboxes to display user's saved choices.
So how to achieve it?
Thanks in advance.
[ { ID:1, Name:"Red"} ...]