Skip to content

docs-bug(mat-select): Disabling the select or individual options #24762

Closed
@dilinipeirs

Description

@dilinipeirs

Documentation Feedback

According to the documentation, when disabling a select by setting a boolean value to [disabled] in the HTML template, it gives a warning as follows.

It looks like you're using the disabled attribute with a reactive form directive. If you set disabled to true
      when you set up this control in your component class, the disabled attribute will actually be set in the DOM for
      you. We recommend using this approach to avoid 'changed after checked' errors.
       
      Example: 
      form = new FormGroup({
        first: new FormControl({value: 'Nancy', disabled: true}, Validators.required),
        last: new FormControl('Drew', Validators.required)
      }); 

There are workarounds suggested by Angular users in various forums etc. Therefore, it is better to change the official Angular Documentation to correctly do this task without obtaining a warning.

Affected documentation page

https://material.angular.io/components/select/overview#disabling-the-select-or-individual-options

Metadata

Metadata

Assignees

Labels

P4A relatively minor issue that is not relevant to core functionsarea: material/selectdocsThis issue is related to documentationgood first issueThis issue is a good place to start for first time contributors to the projecthelp wantedThe team would appreciate a PR from the community to address this issue

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions