首次加载页面时,选择绑定到正确的值(由 ng-init 计算),但只要单击页面上的任何按钮,选择就会丢失其选择的值。我是 angularJS 的新手。ng-model被重置的原因是什么?我该如何解决这个问题?
<div Ng-repeat="(key, value) in Array | groupBy: 'FieldA'">
<div Ng-repeat="(k, v) in value | groupBy: 'FieldB'">
<select Ng-model="v.Selected"
Ng-init="v.Selected = ( Items | where: ID: k | first )"
Ng-options="item.Name for item in Items track by item.ID">
</select>
</div>
</div>