A This project made by the ZELLKON.
npm i mat-select-search-advanced
import { MatSelectSearchAdvancedModule } from 'mat-select-search-advanced';
@NgModule({
imports: [
...
MatSelectSearchAdvancedModule
],
declarations: [
AppComponent,
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }
<mat-select-search-advanced
[objects]="getObject()" indexKey="id"
[viewKey]="['name']"
[searchProperties]="['name', 'age']"
[initData] = "listId"
placeholderSearchLabel="Search by name"
label="List Animal"
messageErrorRequired="You need select some thing"
noEntriesFoundLabel="Found nothing"
tooltipMessage="Select all / Deselect all"
selectAllViewLabel="All animal"
(listSelected$)="getListSelected($event)">
</mat-select-search-advanced>
This code is just a sample
import { Observable, of } from 'rxjs';
getObject(){
return of(yourArray)
}
// if you need change value realtime just use Subject
observableArray: Subject<any[]> = new ReplaySubject<any[]>(1);
// change value observableArray
observableArray.next(newData);
indexKey="id"
[viewKey]="['name', 'age']"
[searchProperties]="['name']"
[showToggleAllCheckbox]="true"
[searchProperties]="['name','age',...]"
placeholderSearchLabel="Search by name"
[initData]="listId"
[initData]="1"
[multiple]="false"
[disabled]="false"
(listSelected$)="getListSelected($event)"
getListSelected(result: any){
console.log(result);
}
getToggleAll(result){
console.log(result);
}