I have a select control that I want to disable dynamically based on a condition:
this.activityForm = this.formBuilder.group({
docType: [{ value: \'2\', disable
You have to handle select elements differently than you do other HTML elements. You will have to perform a reset when this.activeCategory
changes.
Something like this:
this.activityForm.controls['docType'].reset({ value: '2', disabled: false });
Of course, you will probably want to use the current value, rather than a hard coded '2'
.
Same sort of thing to disable it, if that need arises (and it probably will).
this.activityForm.controls['docType'].reset({ value: '2', disabled: true });
More information on ng form control reset.