Skip to content

docs-bug(mat-form-field): required does not work in the custom form field control guide #23352

Closed
@AlexElin

Description

@AlexElin

Documentation Feedback

I need to lock a Submit button when a custom form-field control is empty.
I slightly changed the source Stackblitz example by adding a Submit button (s/b disabled when a form is invalid) and a Name control + setting Validators.required in the form model.

Current behavior: When filling only Name (the Phone number is empty) the form transits to valid state and the button is enabled.
image

Expected behavior: the button must be disabled because the Phone number is empty.

My Stackblitz: https://stackblitz.com/edit/angular-mdsmxs?file=src%2Fapp%2Fform-field-custom-control-example.html

Affected documentation page: https://material.angular.io/guide/creating-a-custom-form-field-control
https://run.stackblitz.com/api/angular/v1?file=src%2Fapp%2Fform-field-custom-control-example.ts

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgentarea: material/form-fielddocsThis issue is related to documentation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions