/
githubmirror
/
components
Обзор
Документация
Войти
/
githubmirror
/
components
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
src/components-examples/material/chips/chips-autocomplete/chips-autocomplete-example.html
30 строк
1 KB
Naji
docs: clear input field whenever a selection is (#30396)
31 янв 2025, 19:49
Не верифицирован
31 янв 2025, 19:49
00515ad
Код
Авторство
О чём код?
<form> <mat-form-field class="example-chip-list"> <mat-label>Favorite Fruits</mat-label> <mat-chip-grid #chipGrid aria-label="Fruit selection"> @for (fruit of fruits(); track $index) { <mat-chip-row (removed)="remove(fruit)"> {{fruit}} <button matChipRemove [attr.aria-label]="'remove ' + fruit"> <mat-icon>cancel</mat-icon> </button> </mat-chip-row> } </mat-chip-grid> <input name="currentFruit" placeholder="New Fruit..." #fruitInput [(ngModel)]="currentFruit" [matChipInputFor]="chipGrid" [matAutocomplete]="auto" [matChipInputSeparatorKeyCodes]="separatorKeysCodes" (matChipInputTokenEnd)="add($event)" /> <mat-autocomplete #auto="matAutocomplete" (optionSelected)="selected($event); fruitInput.value = ''"> @for (fruit of filteredFruits(); track fruit) { <mat-option [value]="fruit">{{fruit}}</mat-option> } </mat-autocomplete> </mat-form-field> </form>