【发布时间】:2015-06-27 18:51:00
【问题描述】:
我使用angularjs 和ui-select (https://github.com/angular-ui/ui-select/)
我有这个代码:
<ui-select tagging="addTagging" tagging-tokens="ENTER" ng-change="sourceChanged()" ng-model="sender" theme="bootstrap" sortable="true" ng-disabled="disabled">
<ui-select-match>{{$select.selected.name}}</ui-select-match>
<ui-select-choices data-id="$index" repeat="item.name as item in places | filter:$select.search">
{{item.name}}
</ui-select-choices>
</ui-select>
在sourceChanged 函数中,我想知道所选项目的索引.. 现在我只有值 (scope.sender)..
我可以在places 数组中搜索值,但这对我来说还不够好,因为有可能会有多个具有相同值的项目...
有什么想法吗?
谢谢:)
【问题讨论】:
标签: javascript angularjs ui-select