我透過 ajax 在控制器中拉取到一個數組,var fruits = ['apple', 'banana'],希望實現的是如下效果:
<select>
<option value='apple'>苹果</option>
<option value='banana'>香蕉</option>
</select>
<select ng-options="fruit for fruit in fruits">
</select>
得到了
<select ng-options="fruit for fruit in fruits">
<option value="0" selected="selected" label="apple">apple</option>
<option value="1" selected="selected" label="apple">banana</option>
</select>
應該怎麼透過修改 ng-options 標籤來修改 value 的值呢?
伊谢尔伦2017-05-15 17:01:55
乾脆直接ng-repeat option 吧···
其實也是有解決方法的:
http://stackoverflow.com/questions/12139152/how-to-set-the-value-property-in-angularjs-ng-options