源代碼:
<select ng-model="dataset.db_id">
<option ng-repeat="x in dataspaceinfo" value="{{x.db_id}}" >{{x.db_ch_name}}</option>
</select>
問題描述:
在ie8下生成select的option時候使用ng-repeat,會造成下拉列表的列表顯示值爲{{x.displayname}}的形式,但是選中之後,選中值卻又是正確的,此問題不在chrome、firefox等最新版上出現。
解決:
使用ng-option代替ng-repeat的實現。
如果你說select綁定了value值,你該怎麼辦? x.value as x.displayName for x in dataspaceinfo
<select ng-model="dataset.db_id" ng-options="x.db_id as x.db_ch_name for x in dataspaceinfo"></select>
解釋:x.value 作爲模型的ng-model的選中的值,x.displayName 爲下拉列表顯示的值,x爲data的其中一個元素。data是列表的對象集合。
原文:http://www.cnblogs.com/fenqi/p/6403996.html