如何在ng-options中重复以下json对象中的名称值。
$scope.networkIds =[
{
"name": "ghdth",
"value": []
},
{
"name": "dddd",
"value": []
},
{
"name": "Nrgyr",
"value": []
},
{
"name": "Ntehyt
"value": []
}
]
目前我正在使用此代码
<select id="networkID" ng-model="usageStatistics.networkID" ng-options="networkID as networkID for networkID in networkIds" ng-change="" class="form-control" ng-required="true">
答案 0 :(得分:0)
用此
替换您的代码$scope.networkIds =[
{
"name": "ghdth",
"value": []
},
{
"name": "dddd",
"value": []
},
{
"name": "Nrgyr",
"value": []
},
{
"name": "Ntehyt",
"value": []
}
];
<select id="networkID" ng-model="usageStatistics.networkID" ng-options="network as network.name for network in networkIds" class="form-control" ng-required="true">
答案 1 :(得分:0)
<select id="networkID" ng-model="usageStatistics.networkID" class="form-control" ng-required="true">
<option ng-repeat"nId in networkIds" value="{{nId.value}}">{{nId.name}}</option>
</select>