Skip to content

Commit

Permalink
docs(material/form-field): custom MatFormFieldControl validation not …
Browse files Browse the repository at this point in the history
…working unless touched (#26873)

Fixes a bug in the Angular Material  where form-control remains valid unless touched. This is because MatFormFieldControl emits null value when form is invalid, but default value was not set to null, bypassing required Validators.

Fixes #23352
  • Loading branch information
Captainnik53 authored Feb 28, 2024
1 parent 6fc0193 commit 76b4ea1
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ import {MatIconModule} from '@angular/material/icon';
})
export class FormFieldCustomControlExample {
form: FormGroup = new FormGroup({
tel: new FormControl(new MyTel('', '', '')),
tel: new FormControl(null),
});
}

Expand Down

0 comments on commit 76b4ea1

Please sign in to comment.