Skip to main content

ClosestFormState

Shared submission state of the form visible through Angular dependency injection.

Import​

import type { ClosestFormState } from '@ngblocks/form-nodes';

When to use it​

Use for shared submission UI built with useClosestFormState(). Its signals normalize Form Nodes, Reactive Forms, and NgForm while retaining optional Form Nodes API access.

Declaration​

type ClosestFormState = {
readonly connected: Signal<boolean>;
readonly source: Signal<'formNode' | 'formGroup' | 'ngForm' | null>;
readonly submitted: Signal<boolean>;
readonly formNode: Signal<CallableNodeApi<FormApi<any>> | null>;
};

Declared members​

The declaration above also includes inherited contracts and overloads where applicable.

MemberMeaning
connectedWhether a supported form is available.
sourceActive forms API, or null when disconnected. Form Nodes takes precedence.
submittedWhether the active form has recorded a submission attempt, including an invalid attempt.
formNodeThe owning Form Nodes form's callable, collision-safe API; null for Angular forms or no form.