I have a reactive form as following:
this.form = this.formBuilder.group({
name: ['', Validators.required],
email: ['', this.customValidator()]
});
I also have a "submit" button with a [disabled]
condition:
<button [disabled]="form.invalid" (click)="create()">Create</button>
If email
input is untouched and I modify name
input, customValidator
is not fired and Create
button enables despite the customValidator()
would return an error.
On the other hand, the name
control has a Validators.required
validation that is fired even if the input is untouched, which is the desired behaviour.
Example on stackblitz: I want the
name
has value on it even if