select in mat-option
<mat-select [(value)]="selected2">
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-----------
<form [formGroup]="searchUserForm" fxFlex fxLayout="column" autocomplete="off" style="margin: 30px">
<mat-select placeholder="User Type" formControlName="userType" multiple>
<mat-option *ngFor="let filters of userTypeFilters" [value]="filters.key" (click)="tosslePerOne(allSelected.viewValue)">
{{filters.value}}
</mat-option>
<mat-option #allSelected (click)="toggleAllSelection()" [value]="0">All</mat-option>
</mat-select>
</form>
Also in JavaScript:
- alphabet only in jquery
- do nonmetals lose electrons
- program to parenthesize an expression
- javascript split
- load_jsonl love jsonl
- create nodejs new object
- body-parser node
- keycode
- javascript compare two arrays of objects get same elements
- json data example
- implement subscript operator js
- what is pug template engine
- javascript push item to beginning of array
- javascript validation for number of characters
- how to save data on database in react form
- javascript object total
- javascript string lentrh
- jest input value
- react native preload local images
- node js list all installed modules
- Changes not staged for commit: modified: ../package.json
- Detect the city on application launch via geolocation react native
- saveas angular 6
- discord js channel send