mat autocomplete async

Solutions on MaxInterview for mat autocomplete async by the best coders in the world

showing results for - "mat autocomplete async"
Mats
28 Jan 2020
1this.usersForm = this.fb.group({
2  userInput: null
3})
4
5this.filteredUsers = this.usersForm
6  .get('userInput')
7  .valueChanges
8  .pipe(
9    debounceTime(300),
10    switchMap(value => this.appService.search({name: value}, 1))
11);
12
13
14<mat-autocomplete #auto="matAutocomplete" [displayWith]="displayFn">
15  <mat-option *ngFor="let user of (filteredUsers | async)?.results" [value]="user">
16    <span>{{ user.name }}</span>
17    <small> | ID: {{user.id}}</small>
18  </mat-option>
19</mat-autocomplete>