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

Class FieldNodeState

packages/forms/signals/src/field/state.ts:21–195  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

19 * status, as well as derived logical state.
20 */
21export class FieldNodeState {
22 /**
23 * Indicates whether this field has been touched directly by the user (as opposed to indirectly by
24 * touching a child field).
25 *
26 * A field is considered directly touched when a user stops editing it for the first time (i.e. on blur)
27 */
28 private readonly selfTouched = signal(false);
29
30 /**
31 * Indicates whether this field has been dirtied directly by the user (as opposed to indirectly by
32 * dirtying a child field).
33 *
34 * A field is considered directly dirtied if a user changed the value of the field at least once.
35 */
36 private readonly selfDirty = signal(false);
37
38 /**
39 * Marks this specific field as touched.
40 */
41 markAsTouched(): void {
42 this.selfTouched.set(true);
43 }
44
45 /**
46 * Marks this specific field as dirty.
47 */
48 markAsDirty(): void {
49 this.selfDirty.set(true);
50 }
51
52 /**
53 * Marks this specific field as not dirty.
54 */
55 markAsPristine(): void {
56 this.selfDirty.set(false);
57 }
58
59 /**
60 * Marks this specific field as not touched.
61 */
62 markAsUntouched(): void {
63 this.selfTouched.set(false);
64 }
65
66 /** The {@link FormField} directives that bind this field to a UI control. */
67 readonly formFieldBindings = signal<readonly FormField<unknown>[]>([]);
68
69 constructor(private readonly node: FieldNode) {}
70
71 /**
72 * Whether this field is considered dirty.
73 *
74 * A field is considered dirty if one of the following is true:
75 * - It was directly dirtied and is interactive
76 * - One of its children is considered dirty
77 */
78 readonly dirty: Signal<boolean> = computed(() => {

Callers

nothing calls this directly

Calls 13

signalFunction · 0.90
computedFunction · 0.90
disabledReasonsMethod · 0.80
readonlyMethod · 0.80
hiddenMethod · 0.80
getMetadataMethod · 0.80
hasMetadataMethod · 0.65
dirtyMethod · 0.45
touchedMethod · 0.45
computeMethod · 0.45
nameMethod · 0.45
keyInParentMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…