(
opts: {onlySelf?: boolean; emitEvent?: boolean; sourceControl?: AbstractControl} = {},
)
| 1287 | */ |
| 1288 | disable(opts: {onlySelf?: boolean; emitEvent?: boolean; sourceControl?: AbstractControl}): void; |
| 1289 | disable( |
| 1290 | opts: {onlySelf?: boolean; emitEvent?: boolean; sourceControl?: AbstractControl} = {}, |
| 1291 | ): void { |
| 1292 | // If parent has been marked artificially dirty we don't want to re-calculate the |
| 1293 | // parent's dirtiness based on the children. |
| 1294 | const skipPristineCheck = this._parentMarkedDirty(opts.onlySelf); |
| 1295 | |
| 1296 | this.status = DISABLED; |
| 1297 | this.errors = null; |
| 1298 | this._forEachChild((control: AbstractControl) => { |
| 1299 | /** We don't propagate the source control downwards */ |
| 1300 | control.disable({...opts, onlySelf: true}); |
| 1301 | }); |
| 1302 | this._updateValue(); |
| 1303 | |
| 1304 | const sourceControl = opts.sourceControl ?? this; |
| 1305 | if (opts.emitEvent !== false) { |
| 1306 | this._events.next(new ValueChangeEvent(this.value, sourceControl)); |
| 1307 | this._events.next(new StatusChangeEvent(this.status, sourceControl)); |
| 1308 | (this.valueChanges as EventEmitter<TValue>).emit(this.value); |
| 1309 | (this.statusChanges as EventEmitter<FormControlStatus>).emit(this.status); |
| 1310 | } |
| 1311 | |
| 1312 | this._updateAncestors({...opts, skipPristineCheck}, this); |
| 1313 | this._onDisabledChange.forEach((changeFn) => changeFn(true)); |
| 1314 | } |
| 1315 | |
| 1316 | /** |
| 1317 | * Enables the control. This means the control is included in validation checks and |
nothing calls this directly
no test coverage detected