I have the following users object loaded using a AngularJS factory:
{
"user_id": "1",
"groups": [
{
"name": "Object Group 10",
"group_id": 10
}
]
},
{
"user_id": "2",
"groups": [
{
"name": "Object Group 10",
"group_id": 10
},
{
"name": "Object Group 12",
"group_id": 12
}
]
}
I then have groups loaded using a separate factory.
[
{
"name": "Object Group 10",
"group_id": 10
},
{
"name": "Object Group 12",
"group_id": 12
}
]
I am trying to bind a checkbox on the user form so that it is checked when the group exists in user.groups array.
See code below:
<div ng-repeat="group in groups">
<input type="checkbox" ng-model="user.groups">
</div>
Any help would be appreciated.
In controller: