fix(forms): make setDisabledState optional for reactive form directives (#11731)
Closes #11719
This commit is contained in:
@ -90,7 +90,9 @@ export class FormControlDirective extends NgControl implements OnChanges {
|
||||
ngOnChanges(changes: SimpleChanges): void {
|
||||
if (this._isControlChanged(changes)) {
|
||||
setUpControl(this.form, this);
|
||||
if (this.control.disabled) this.valueAccessor.setDisabledState(true);
|
||||
if (this.control.disabled && this.valueAccessor.setDisabledState) {
|
||||
this.valueAccessor.setDisabledState(true);
|
||||
}
|
||||
this.form.updateValueAndValidity({emitEvent: false});
|
||||
}
|
||||
if (isPropertyUpdated(changes, this.viewModel)) {
|
||||
|
@ -152,7 +152,9 @@ export class FormControlName extends NgControl implements OnChanges, OnDestroy {
|
||||
private _setUpControl() {
|
||||
this._checkParentType();
|
||||
this._control = this.formDirective.addControl(this);
|
||||
if (this.control.disabled) this.valueAccessor.setDisabledState(true);
|
||||
if (this.control.disabled && this.valueAccessor.setDisabledState) {
|
||||
this.valueAccessor.setDisabledState(true);
|
||||
}
|
||||
this._added = true;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user