MCPcopy Create free account
hub / github.com/angular/angular / _reset

Method _reset

packages/forms/signals/src/field/node.ts:336–359  ·  view source on GitHub ↗
(value?: unknown)

Source from the content-addressed store, hash-verified

334 }
335
336 private _reset(value?: unknown) {
337 this.pendingSync()?.abort();
338
339 if (value !== undefined) {
340 this.value.set(value);
341 }
342
343 // controlValue is a linkedSignal that only auto-resets when value *changes*.
344 // When the reset value equals the current value (or no value was passed),
345 // controlValue retains the typed text. Force it to match value by setting
346 // directly via the raw interface, which doesn't trigger a sync.
347 this.controlValue.rawSet(this.value());
348
349 this.nodeState.markAsUntouched();
350 this.nodeState.markAsPristine();
351
352 for (const binding of this.formFieldBindings()) {
353 binding.reset();
354 }
355
356 for (const child of this.structure.materializedChildren()) {
357 child._reset();
358 }
359 }
360
361 /**
362 * Reloads all asynchronous validators for this field and its descendants.

Callers 1

resetMethod · 0.95

Calls 8

valueMethod · 0.95
formFieldBindingsMethod · 0.95
rawSetMethod · 0.80
abortMethod · 0.65
setMethod · 0.65
resetMethod · 0.65
markAsUntouchedMethod · 0.45
markAsPristineMethod · 0.45

Tested by

no test coverage detected