📜  mat-select 选项以选择所有选项 - 无论代码示例

📅  最后修改于: 2022-03-11 14:59:43.205000             🧑  作者: Mango

代码示例1
tosslePerOne(all){ 
   if (this.allSelected.selected) {  
    this.allSelected.deselect();
    return false;
}
  if(this.searchUserForm.controls.userType.value.length==this.userTypeFilters.length)
    this.allSelected.select();

}
  toggleAllSelection() {
    if (this.allSelected.selected) {
      this.searchUserForm.controls.userType
        .patchValue([...this.userTypeFilters.map(item => item.key), 0]);
    } else {
      this.searchUserForm.controls.userType.patchValue([]);
    }
  }
  
-------------------  HTML-----------

{{filters.value}} All