0

I want to implement a custom ErrorStateMatcher to show errors even when the formControl is not toched for a matInput from a 3rd party library.

I have implemented an ErrorStateMatcher to do this job, but when I provide it on a component level, it does not work.

Stackblitz

In the example above, it only works when providing it on a module level (one can uncomment the providers in the app.module.ts)

Note: Manually creating an instance of the ErrorStateMatcher and passing it to the matInput is not possible to me, since I don't have access to the template where the matInput belongs.

1 Answer 1

1

You import ErrorStateMatcher class from wrong place. Correct way to import ErrorStateMatcher(like in your module):

import { ErrorStateMatcher } from '@angular/material';

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.