[Angular] Reactive Forms Multi-field Custom Validation

Let's say we have a date picker compoent which display start date and end date. We want to make sure that start date is no later than end date, if it was, display an error message.

[Angular] Reactive Forms Multi-field Custom Validation

 

Validators:

[Angular] Reactive Forms Multi-field Custom Validation

Return null means form is valid. Return object means form has error.

 

Usage:

[Angular] Reactive Forms Multi-field Custom Validation

 

[Angular] Reactive Forms Multi-field Custom Validation

上一篇:2021-05-31


下一篇:手百小程序-自定义组件