Skip to content

@absoluteui/angular/forms

Angular forms support shared by every form control: control state, validation message mapping, and error keys.

import { AUI_FORM_ERRORS, provideAuiFormErrors } from '@absoluteui/angular/forms';

provideAuiFormErrors

Messages for your own validators (or overrides of the defaults): provideAuiFormErrors({ forbiddenName: 'This name is taken.', minlength: (e) => ... }).

function provideAuiFormErrors(messages: AuiFormErrorMessages): Provider;

AUI_FORM_ERRORS

const AUI_FORM_ERRORS: InjectionToken<Readonly<Record<string, string | ((error: unknown) => string)>>>;

AuiControlState

Angular form state of a control, as signals (all false without a form binding).

interface AuiControlState {
readonly touched: Signal<boolean>;
readonly dirty: Signal<boolean>;
readonly pending: Signal<boolean>;
readonly submitted: Signal<boolean>;
readonly errorState: Signal<boolean>;
}

AuiFormErrorMessages

Message per validator error key: text, or a function of the error value.

type AuiFormErrorMessages = Readonly<Record<string, string | ((error: unknown) => string)>>;