如何更改ui-select中的选择列表?
How to change the choice list in ui-select?
我有一个基本的 ui-select 组件,还有一个案例需要为 ui-select 使用另一个列表。
如何在单击按钮或通过其他函数调用时将此处的“somelist
”更改为“anotherlist
”?
<ui-select ng-model="obj.selected">
<ui-select-match>{{$select.selected.dsc}}</ui-select-match>
<ui-select-choices repeat=" X in somelist | propsFilter: {dsc: $select.search}">
<div ng-bind-html="X.dsc | highlight: $select.search" position='down'></div>
</ui-select-choices>
</ui-select>
<button>Change list</button>
我得到了这个解决方案;
我猜 ui-select 在 somelist
得到 undefined
时刷新,然后再次填充。所以这对我有用:
somelist = undefined;
somelist = anotherlist;
我有一个基本的 ui-select 组件,还有一个案例需要为 ui-select 使用另一个列表。
如何在单击按钮或通过其他函数调用时将此处的“somelist
”更改为“anotherlist
”?
<ui-select ng-model="obj.selected">
<ui-select-match>{{$select.selected.dsc}}</ui-select-match>
<ui-select-choices repeat=" X in somelist | propsFilter: {dsc: $select.search}">
<div ng-bind-html="X.dsc | highlight: $select.search" position='down'></div>
</ui-select-choices>
</ui-select>
<button>Change list</button>
我得到了这个解决方案;
我猜 ui-select 在 somelist
得到 undefined
时刷新,然后再次填充。所以这对我有用:
somelist = undefined;
somelist = anotherlist;