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

Method reset

packages/forms/src/model/form_group.ts:563–576  ·  view source on GitHub ↗

* Resets the `FormGroup`, marks all descendants `pristine` and `untouched` and sets * the value of all descendants to their default values, or null if no defaults were provided. * * You reset to a specific form state by passing in a map of states * that matches the structure of your form

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

Source from the content-addressed store, hash-verified

561 * ```
562 */
563 override reset(
564 value: ɵTypedOrUntyped<TControl, ɵFormGroupArgumentValue<TControl>, any> = {},
565 options: {onlySelf?: boolean; emitEvent?: boolean; overwriteDefaultValue?: boolean} = {},
566 ): void {
567 this._forEachChild((control: AbstractControl, name) => {
568 control.reset(value ? (value as any)[name] : null, {...options, onlySelf: true});
569 });
570 this._updatePristine(options, this);
571 this._updateTouched(options, this);
572 this.updateValueAndValidity(options);
573 if (options?.emitEvent !== false) {
574 this._events.next(new FormResetEvent(this));
575 }
576 }
577
578 /**
579 * The aggregate value of the `FormGroup`, 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