源代码:
<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