Skip to content

Commit 76b4ea1

Browse files
authoredFeb 28, 2024··
docs(material/form-field): custom MatFormFieldControl validation not 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
1 parent 6fc0193 commit 76b4ea1

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed
 

‎src/components-examples/material/form-field/form-field-custom-control/form-field-custom-control-example.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ import {MatIconModule} from '@angular/material/icon';
4646
})
4747
export class FormFieldCustomControlExample {
4848
form: FormGroup = new FormGroup({
49-
tel: new FormControl(new MyTel('', '', '')),
49+
tel: new FormControl(null),
5050
});
5151
}
5252

0 commit comments

Comments
 (0)
Please sign in to comment.