The mustMatch
validator can be used to check if two
different form fields has the same value. For example, a
Confirm password should have the same value with
the Password field. To validate that, the
mustMatch
validator can be used.
Name | Description |
---|---|
controlPath: string
|
A dot-delimited string values that define the path to the control. |
matchingControlPath: string
|
A dot-delimited string values that define the path to the matching control. |
Because the mustMatch
validator requires parameters, it
must be used within the validators
option of the form
builder:
To show an error message on the field, the
mat-error
element can be used within the
mat-form-field
: