好的,我有一个选择
<select id="minutes-to-dropdown"
required=""
ng-model="AddEventPopupStore.ToMinutes"
name="minutes-to-dropdown"
ng-change="AddEventPopupStore.UpdateTimeFromPopup()"
ng-options="num as num for num in [0,15,30,45]"
class="popup-subdropdown">
<option disabled="" value="">min</option>
</select>
它用于通过ng-show
切换的弹出窗口(不确定这会如何影响破坏/重新创建范围)
当选择因点击次数和型号都发生变化时,selected
属性无法正确更新。经过几次更新后我得到了
<select id="minutes-to-dropdown"
required=""
ng-model="AddEventPopupStore.ToMinutes"
name="minutes-to-dropdown"
ng-change="AddEventPopupStore.UpdateTimeFromPopup()"
ng-options="num as num for num in [0,15,30,45]"
class="popup-subdropdown">
<option disabled="" value="" selected="selected">min</option>
<option label="0" value="number:0" selected="selected">0</option>
<option label="15" value="number:15" selected="selected">15</option>
<option label="30" value="number:30" selected="selected">30</option>
<option label="45" value="number:45" selected="selected">45</option>
</select>
当我选择另一个值时模型发生变化,如果我关闭弹出窗口并重新打开它,模型和选择不匹配,因为显示的是最后selected
值而不是实际值{{1来自模特。
如何强制将选择更新为模型中的实际选择?我想我可能不得不强制删除所有selected
并将其重新应用到新的selected
。