-
Notifications
You must be signed in to change notification settings - Fork 6.8k
Closed
Description
Bug, feature request, or proposal:
Bug
<form [formGroup]='group'>
<mat-form-field class="example-chip-list">
<mat-chip-list #chipList>
<mat-chip *ngFor="let fruit of fruits" [selectable]="selectable"
[removable]="removable" (removed)="remove(fruit)">
{{fruit.name}}
<mat-icon matChipRemove *ngIf="removable">cancel</mat-icon>
</mat-chip>
<!-- add formContorlName 'newFruit' -->
<input placeholder="New fruit..."
formContorlName='newFruit'
[matChipInputFor]="chipList"
[matChipInputSeparatorKeyCodes]="separatorKeysCodes"
[matChipInputAddOnBlur]="addOnBlur"
(matChipInputTokenEnd)="add($event)">
</mat-chip-list>
<!-- add mat-error -->
<mat-error *ngIf="group.controls.newFruit.hasError('required')">required!</mat-error>
</mat-form-field>
</form>
What is the expected behavior?
In this case, it can display error!
What is the current behavior?
If input is empty, no error will be displayed.
What are the steps to reproduce?
https://stackblitz.com/angular/pxxkxklrgaqg?file=app%2Fchips-input-example.html
You can try it on your example..
What is the use-case or motivation for changing an existing behavior?
Displaying error prompts when errors occur
Which versions of Angular, Material, OS, TypeScript, browsers are affected?
All latest
Is there anything else we should know?
No.
Metadata
Metadata
Assignees
Labels
No labels