Skip to content
Advertisement

Angular Material Mat-error Showing error for valid inputs, while validating with regex

Creating a signup form using angular material, It is displaying errors even if there is no error.

For a valid input it is displaying the error Invalid Input. I’ve removed that mat-error condition the field is turning red while entering data.

The status inside the control is showing the field is valid on submit.

enter image description here

The error conditions are in in global constants file. -Global const ts

JavaScript

HTML-

JavaScript

Signup Ts File:

JavaScript

Kindly assist with your expertise.

Advertisement

Answer

Please check the following code

input-error-state-matcher.ts

JavaScript

input-error-state-matcher.html

JavaScript

working example is here

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement