Cross-reference Validation

We’ve seen how basic Angular form validation works and how it’s possible to create custom validators when there’s the need to implement a logic that’s not covered by the built-in validators.

In some circumstances, the validation logic requires considering the value of multiple controls simultaneously. We’ve learned how to apply validators to a single control, but how do we implement a validation that considers various fields at once? Cross-reference validation, as the name suggests, allows gathering the controls’ values across the form and combining them in a single custom validator.

Get hands-on with 1200+ tech skills courses.