(
opts: {onlySelf?: boolean; emitEvent?: boolean; sourceControl?: AbstractControl} = {},
)
| 1264 | */ |
| 1265 | disable(opts: {onlySelf?: boolean; emitEvent?: boolean; sourceControl?: AbstractControl}): void; |
| 1266 | disable( |
| 1267 | opts: {onlySelf?: boolean; emitEvent?: boolean; sourceControl?: AbstractControl} = {}, |
| 1268 | ): void { |
| 1269 | // If parent has been marked artificially dirty we don't want to re-calculate the |
| 1270 | // parent's dirtiness based on the children. |
| 1271 | const skipPristineCheck = this._parentMarkedDirty(opts.onlySelf); |
| 1272 | |
| 1273 | this.status = DISABLED; |
| 1274 | (this as Writable<this>).errors = null; |
| 1275 | this._forEachChild((control: AbstractControl) => { |
| 1276 | /** We don't propagate the source control downwards */ |
| 1277 | control.disable({...opts, onlySelf: true}); |
| 1278 | }); |
| 1279 | this._updateValue(); |
| 1280 | |
| 1281 | const sourceControl = opts.sourceControl ?? this; |
| 1282 | if (opts.emitEvent !== false) { |
| 1283 | this._events.next(new ValueChangeEvent(this.value, sourceControl)); |
| 1284 | this._events.next(new StatusChangeEvent(this.status, sourceControl)); |
| 1285 | (this.valueChanges as EventEmitter<TValue>).emit(this.value); |
| 1286 | (this.statusChanges as EventEmitter<FormControlStatus>).emit(this.status); |
| 1287 | } |
| 1288 | |
| 1289 | this._updateAncestors({...opts, skipPristineCheck}, this); |
| 1290 | this._onDisabledChange.forEach((changeFn) => changeFn(true)); |
| 1291 | } |
| 1292 | |
| 1293 | /** |
| 1294 | * Enables the control. This means the control is included in validation checks and |
nothing calls this directly
no test coverage detected
searching dependent graphs…