I am wondering if there is a Validator that compares two different values from the same form - lets say I have the following:
this.loginForm = fb.group({
email: ["", Validators.required],
password: ["", Validators.required],
repeatPassword: ["", Validators.required]
});
I found this in documentation, however it wasn't very helpful.
Any ideas?
You need to assign a validator to a complete form group to implement this. Something like that:
This way you will have access to all controls of the group and not only one... This can be accessed using the
controls
property of the group control. The latter (not a single one) is directly provided when validation is triggered. For example:See this question for more details: