Reputation: 155
I am facing a issue while adding multiple custom validation to a form. I can only add a single custom validation to my form. How to add multiple validations.
Eg:
this.user = this.fb.group({
name: ['', Validators.required],
account: this.fb.group({
email: ['', Validators.required],
confirm: ['', Validators.required]
}, { validator: emailMatcher })
});
I want to add more validations like: { validator: [emailMatcher, matchPassword, othervalidation]}
Is there something in angular 2 which can help me in this.
Upvotes: 3
Views: 3936
Reputation: 2645
Instead of :
{ validator: emailMatcher })
Use syntax:
{ validators: [emailMatcher, matchPassword, othervalidation]}
Good luck.
Upvotes: 3