我在ng-options
上使用<select>
,ng-options="item.model for item in prodataSelect | unique:'model' "
但我希望生成的选项的<value=""
标记包含item.id
,而不是ng-options使用的自动增量值。
如何实现这一目标?
HTML:
<select id = "chosenmodel" class="button button-full button-dark" ng-model="selectedModel" ng-options="item.model for item in prodataSelect | unique:'model' ">
<option value="">Select a Model</option>
</select>
<a id="submitbutton" class="button button-block button-dark ui-btn ui-btn-b ui-corner-all" ng-click='launchCompute()' href="#/app/compute/result">Compute my board</a>
prodataSelect
中的每个项目都是一个对象:
{
brand: "John",
fun: "0",
id: 1
},
{
brand: "you",
fun: "0",
id: 185
},
{
brand: "Ark",
fun: "0",
id: 17
},
答案 0 :(得分:1)
答案 1 :(得分:0)
使用&#34;按项目跟踪&#34; 将选项值设置为id
ng-options="item.id as item.model for item in prodataSelect track by item.id"