【发布时间】:2017-01-29 06:57:35
【问题描述】:
我正在尝试使用 ng2-select 实现多选 这里是可以查看块代码,
<ng-select
[multiple]="true"
[items]="items"
[disabled]="disabled"
(data)="refreshValue($event)"
(selected)="selected($event)"
(removed)="removed($event)"
placeholder="Select from list"></ng-select>
在组件中我有项目列表和选定值列表
private value:any = [{id: "1", text: "User A"}];
private items:Array<Object> = [{id: "1", text: "User A"},{id: "2", text: "User B"},{id: "3", text: "User C"}];
private selected(value:any) {
console.log('Selected value is: ', value);
}
private removed(value:any) {
console.log('Removed value is: ', value);
}
private refreshValue(value:any) {
this.value = value;
}
如何在其中实现“全选”和“取消全选”功能,并且 ng-select 不会填充视图中的选择项。
【问题讨论】:
-
即使这是较旧的帖子,也无法发布重复问题的重复答案,因此如果您需要答案,请参阅stackoverflow.com/a/54544217/1148107
标签: angular multi-select selectall