我有一个名为groupList的对象,如下所示:
{
"12777e85-c03a-97ba-42ce-3242b6bd4109": {
"id": "12777e85-c03a-97ba-42ce-3242b6bd4109",
"name": "uber name for group"
},
"57415d36-e935-cc6a-11b4-0b95bce5cb95": {
"id": "57415d36-e935-cc6a-11b4-0b95bce5cb95",
"name": "a group name"
},
"65c9cf1d-0876-1faf-7986-e44bbba8d0fe": {
"id": "65c9cf1d-0876-1faf-7986-e44bbba8d0fe",
"name": "users"
},
"d3525828-0b53-a7eb-6c17-ea142a54687e": {
"id": "d3525828-0b53-a7eb-6c17-ea142a54687e",
"name": "admin"
}
}
我正试图在选择框中使用它。我只需要执行ng-repeat="group in groupList
就可以毫不费力地重复数据,但这对ng-option不起作用。我正变得不稳定:ng-options="name for (id, name) in groupList"
其中groupList是我正在反对的对象。我只是不在那里。
有什么想法吗?
答案 0 :(得分:0)
你很亲密,this你追求的是什么?
<select ng-options="key as value.name for (key, value) in groupList" ng-model="selected"/>