ngModel 对于输入类型文本和选择的工作方式是否不同?不选择选择控件以反映初始模型值。
当我更改选择的值时,输入和 currentUser.field 也会更改,但是如果我将输入文本的值更改为另一个键,则不会发生任何选择。
{{currentUser.field}} // show correct field field key (number) val
// ng-model works => show correct field key (number) val
<input ng-model="currentUser.field" type="text" />
// <option value="?" selected="selected" label=""></option> is selected
<select ng-model="currentUser.field"
ng-options='item.key as item.value for item in currentUser.collections.field '>
</select>
// only works with input text and {{currentUser.field}}
<button ng-click='currentUser.field = 305'>select field (int)</button>
<button ng-click='currentUser.field = "305"'>select field (string)</button>