I am trying to do validation using the and . This works fine when user tabs out of the input without filling. B
Based on Kyle Pfromer's post, I found my solution (to the same problem):
In the TS file I added the StateMatcher after I found an invalid form, eg.
if (this.myFormGroup.invalid) {
this.matcher = new MyErrorStateMatcher();
return;
}
In the MyErrorStateMatcher class I changed as following:
return !!(control && control.invalid);
I find it confusing that Angular Material is not detecting the error anyway.