如果没有要选择的项目
,如何禁用ui-select- multi select的选择框<ui-select
multiple theme="bootstrap"
ng-model="categories.selected"
on-select="selectCategory($item,$model)">
<ui-select-match placeholder="Select Item...">{{$item.name}}</ui-select-match>
<ui-select-choices
repeat="category in categories.categories track by category.id">
{{category.name}}
</ui-select-choices>
</ui-select>
答案 0 :(得分:0)
ui-select
指令提供ng-disabled
属性。
示例:
<ui-select
multiple theme="bootstrap"
ng-model="categories.selected"
on-select="selectCategory($item,$model)"
ng-disabled="categories.categories.length === 0">
<ui-select-match placeholder="Select Item...">{{$item.name}}</ui-select-match>
<ui-select-choices
repeat="category in categories.categories track by category.id">
{{category.name}}
</ui-select-choices>
</ui-select>
答案 1 :(得分:0)
您始终可以使用ng-disabled
禁用Angular提供的任何组件。因此,您也可以将ng-disabled
与ui-select
一起使用。
<ui-select
multiple theme="bootstrap"
ng-model="categories.selected"
ng-disabled="categories.selected.length === 0"
on-select="selectCategory($item,$model)">
<ui-select-match placeholder="Select Item...">{{$item.name}}</ui-select-match>
<ui-select-choices
repeat="category in categories.categories track by category.id">
{{category.name}}
</ui-select-choices>
</ui-select>