【发布时间】:2016-04-20 12:45:45
【问题描述】:
我试图使用ui-select 指令将$index 绑定到ng-model,但没有运气。
<ui-select ng-model="selected.m">
<ui-select-match>
<span ng-bind="$select.selected.name"></span>
</ui-select-match>
<ui-select-choices repeat="$index as choice in itemArray">
<span ng-bind="choice + '' + $index"></span>
</ui-select-choices>
</ui-select>
在上面的模板中itemArray 是一个月份名称数组,从下拉列表中选择任何月份后,我想将其$index 绑定到ng-model(即'selected.m')。
我已经准备好this plunker。
【问题讨论】:
标签: angularjs angular-ui-select