我尝试根据ng-repeat中的值设置正确的选择选项。
请参阅此处的示例:https://jsfiddle.net/vok080z4/5/
疯了,如果你查看这个例子,为什么dave会设置为苹果,但没有其他人呢?
<body ng-app="eApp">
<div ng-controller="splitsController" ng-cloak>
<table class="widefat fixed" cellspacing="0">
<thead class="thead">
<tr>
<th>Name</th>
<th>Fruit</th>
</tr>
</thead>
<tbody class="tbody">
<tr ng-repeat="order in data.orders" ng-class-odd="'alternate'">
<td>{{order.name}}</td>
<td>
<select ng-model="fruitSelect">
<option value="">-- Select One --</option>
<option ng-repeat="fruit in data.fruits track by fruit.id" value="{{fruit.id}}" ng-selected="fruit.id === order.fruitId">
{{fruit.name}}
</option>
</select>
</td>
<td>
</tr>
</tbody>
</table>
</div>
</body>