MCPcopy Index your code
hub / github.com/angular/angular / reset

Method reset

packages/forms/src/model/form_array.ts:434–451  ·  view source on GitHub ↗

* Resets the `FormArray` and all descendants are marked `pristine` and `untouched`, and the * value of all descendants to null or null maps. * * You reset to a specific form state by passing in an array of states * that matches the structure of the control. The state is a standalone valu

(
    value: ɵTypedOrUntyped<TControl, ɵFormArrayValue<TControl>, any> = [],
    options: {
      onlySelf?: boolean;
      emitEvent?: boolean;
      overwriteDefaultValue?: boolean;
    } = {},
  )

Source from the content-addressed store, hash-verified

432 * updateValueAndValidity} method.
433 */
434 override reset(
435 value: ɵTypedOrUntyped<TControl, ɵFormArrayValue<TControl>, any> = [],
436 options: {
437 onlySelf?: boolean;
438 emitEvent?: boolean;
439 overwriteDefaultValue?: boolean;
440 } = {},
441 ): void {
442 this._forEachChild((control: AbstractControl, index: number) => {
443 control.reset(value[index], {...options, onlySelf: true});
444 });
445 this._updatePristine(options, this);
446 this._updateTouched(options, this);
447 this.updateValueAndValidity(options);
448 if (options?.emitEvent !== false) {
449 this._events.next(new FormResetEvent(this));
450 }
451 }
452
453 /**
454 * The aggregate value of the array, including any disabled controls.

Callers

nothing calls this directly

Calls 4

_forEachChildMethod · 0.95
resetMethod · 0.65
nextMethod · 0.45

Tested by

no test coverage detected