Closed
Description
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