Components: mat-error with MatChipInput is not displayed under the input

Created on 10 May 2018  路  4Comments  路  Source: angular/components

Bug, feature request, or proposal:

Bug

What is the expected behavior?

Be able to use mat-error with MatChipInput in the same way that we can use mat-hint.

What is the current behavior?

The error message is not visible below the input.

What are the steps to reproduce?

Providing a StackBlitz reproduction is the best way to share your issue.

https://stackblitz.com/edit/angular-ktsffr

What is the use-case or motivation for changing an existing behavior?

Example use case: show <mat-error> when more than 3 chips are in the chip list.

Which versions of Angular, Material, OS, TypeScript, browsers are affected?

Material 6.0.0

Is there anything else we should know?

Placing <mat-error> inside <mat-chip-list> just below <input> shows the error message but it not in the correct location (i.e. below the input's line). Please see provided StackBlitz.

Most helpful comment

This works as intended. Error text only appears when the form field is in an error state. If you look at the documentation, MatChipList has an errorState property which you need to set to true when there is an error.

Here is how to do it:
https://stackblitz.com/edit/angular-matchiplist-with-error-message?file=app/chips-input-example.html

All 4 comments

This works as intended. Error text only appears when the form field is in an error state. If you look at the documentation, MatChipList has an errorState property which you need to set to true when there is an error.

Here is how to do it:
https://stackblitz.com/edit/angular-matchiplist-with-error-message?file=app/chips-input-example.html

Thank you @CurtisDS!

thank you

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

_This action has been performed automatically by a bot._

Was this page helpful?
0 / 5 - 0 ratings