I've got a problem with my reactive forms - my repeatPassword doesn't refresh. If I write something in "password" label, then in "repeatPassword" and again in "password" the second one is not marked as invalid.
So I decided to do something like that:
if (this.form.get('password').value !== this.form.get('passwordRepeat').value) {
this.form.get('passwordRepeat').setErrors({'invalid': true});
}
if (this.form.get('password').value === this.form.get('passwordRepeat').value &&
!this.form.get('passwordRepeat').hasError) {
this.form.get('passwordRepeat').setErrors({'invalid': null});
}
The code looks fine until I try to set invalid to null - reactive forms treat it like an error, so I can't submit and ngif shows an error.
The same error occurs when I'm trying to accept rules - unchecking checkbox doesn't mark it as invalid.
Is there any option that forces validators to run once again?