angular / angular/components

Support async ErrorStateMatcher

Open
#15,453 5 comments 7 reactions 0 assignees View on GitHub
area: material/form-field feature P3
Dominant language
TypeScript
Stars
25k
Forks
6.8k
Avg merge
1d 8h
Merged PRs (30d)
91

Description

#### Please describe the feature you would like to request.

Currently, `ErrorStateMatcher` doesn't support return type `Promise` and `Observable`. Its return type is only `boolean`.

#### What is the use-case or motivation for this proposal?

I need to show `` when checked `input` is invalid after validation. This validation does need to call HTTP request(async). For example, when ID field in registration form is not unique, i should show `` because registration form doesn't allow to use the input's value as duplicated ID with other user. To provide this feature, `ErrorStateMatcher` has to support return type as `Promise` or `Observable`.

Contributor guide

Open the contributing guide

Research direction

Start by reading the ErrorStateMatcher API and the existing mat-error validation flow, focusing on how the input's validity is checked. Compare the requested Promise and Observable cases, then define completion as async validation results reliably causing the appropriate mat-error state for duplicate IDs.

Written by the indexing model from the issue text.

Assessment

Tech stack
angular, typescript
Domain
frontend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.