MCPcopy
hub / github.com/angular/angular / _reset

Method _reset

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

Source from the content-addressed store, hash-verified

329 }
330
331 private _reset(value?: unknown) {
332 this.pendingSync()?.abort();
333
334 if (value !== undefined) {
335 this.value.set(value);
336 }
337
338 // controlValue is a linkedSignal that only auto-resets when value *changes*.
339 // When the reset value equals the current value (or no value was passed),
340 // controlValue retains the typed text. Force it to match value by setting
341 // directly via the raw interface, which doesn't trigger a sync.
342 this.controlValue.rawSet(this.value());
343
344 this.nodeState.markAsUntouched();
345 this.nodeState.markAsPristine();
346
347 for (const binding of this.formFieldBindings()) {
348 binding.reset();
349 }
350
351 for (const child of this.structure.materializedChildren()) {
352 child._reset();
353 }
354 }
355
356 /**
357 * 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