How To Bind To List Of Checkbox Values In AngularJS
Here we consider how to bind to list of Checkbox values in AngularJS.
Suppose there is a list of fruits that is attached with the Controller.
We are trying to bind this list with a group of Checkbox on the View.
Whenever the checkbox is changed, it would reflect in the Controller also.
For Single Checkbox, we can do this task by using ng-model.
Lets consider how can we do this for a group of Checkboxes.
Here is an example. Suppose there is a list of Fruits attached with the Controller.
We can attach this list to the group of Checkboxes as follows.
Here we make use of ng-repeat for binding the list of fruits.
Each ng-repeat list item will be bind to the checkbox by using ng-model.
When object is used as datasource, we can use this method.
This would allow us to Bind To List Of Checkbox Values In AngularJS.