html代码
<select id="userGroups" name="userGroups" ng-model="userGroups"
ng-init="userGroups = userGroups || groups[0].groupId"
ng-options="grp.groupId as grp.groupName for grp in groups" class="form-control"></select>
但生成的选项就像这样
<option value="0" selected="selected">admins</option>
<option value="1">user</option>
它必须是这样的,因为admin的id为1而用户的id为2
<option value="1" selected="selected">admins</option>
<option value="2">user</option>
这是团体的json,我通过{{ groups | json }}
[
{
"groupId": 1,
"groupName": "admins"
},
{
"groupId": 2,
"groupName": "users"
}
]