我有一个这样的选择字段:
<select ng-init="exchangeOption = widget.content.exchange[0]"
ng-Model="exchangeOption"
ng-options="exchangeOption.title for exchangeOption in widget.content.exchange"
ng-change="internalLink(exchangeOption.url)">
</select>
如您所见,现在我总是选择第一个选项。但是实际上,“交换”具有一个“选定的”字段,它是一个布尔值,如果该选项应为选定的,则设置为true。
你会怎么做?
提前致谢!
您可以编写一种方法来通过过滤交换来返回选定的交换选项。
<select ng-init="exchangeOption = getSelectedExchange()"
ng-Model="exchangeOption" ng-options="exchangeOption.title for exchangeOption in widget.content.exchange"
ng-change= "internalLink(exchangeOption.url)"> </select>
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句