【发布时间】:2017-01-21 18:53:27
【问题描述】:
是否可以在 AngularJS ui-select 类型的 multiple 中自动重新排序所选项目?
这是一个代码示例,ui-select github 上还有更多
<ui-select multiple ng-model="ctrl.multipleDemo.colors" theme="bootstrap" ng-disabled="ctrl.disabled" close-on-select="false" style="width: 300px;" title="Choose a color">
<ui-select-match placeholder="Select colors...">{{$item}}</ui-select-match>
<ui-select-choices repeat="color in ctrl.availableColors | filter:$select.search">
{{color}}
</ui-select-choices>
这是其行为的屏幕截图:
我想要的是重新排序的选定项目:即使当我选择项目时,我先选择了黄色,然后是绿色,然后是蓝色,我希望它是蓝色、绿色、黄色。
我看到了一个名为 sortable="true" 的属性,但它似乎没有达到我的预期。
【问题讨论】:
标签: javascript angularjs angular-ui-select