RunicFieldDirective class

Module @runic-artifex/angular/forms in @runic-artifex/angular 0.23.0

class RunicFieldDirective implements ControlValueAccessor, Validator

Wires an <input>, <textarea> or <select> to an injectField handle: <input [runicField]="title">. Alone, it writes what the user types (input; change for checkboxes, radios and selects), holds writes during IME composition, commits on blur, keeps the element's value (or checked) equal to the field without moving the caret, and sets aria-invalid while the field has an error or errors. It is also the ControlValueAccessor and Validator of a formControl or formControlName on the same element: the View's value flows into the control without marking it dirty or emitting valueChanges, the user's input reaches it as usual, patchValue and reset write through to the View when they change the value, disable() disables the element, and the control is invalid with { runic: errors } while the View reports errors.

Constructors

constructor

constructor();

No documentation.

Properties

runicField

readonly runicField: import("@angular/core").InputSignal<FieldHandle<unknown>>;

The field to wire, from injectField .

invalid

protected readonly invalid: import("@angular/core").Signal<boolean>;

No documentation.

ɵfac

static ɵfac: i0.ɵɵFactoryDeclaration<RunicFieldDirective, never>;

No documentation.

ɵdir

static ɵdir: i0.ɵɵDirectiveDeclaration<RunicFieldDirective, "[runicField]", never, {
    "runicField": {
        "alias": "runicField";
        "required": true;
        "isSignal": true;
    };
}, {}, never, never, true, never>;

No documentation.

Methods

onInput

protected onInput(): void;

No documentation.

onChange

protected onChange(): void;

No documentation.

onCompositionStart

protected onCompositionStart(): void;

No documentation.

onCompositionEnd

protected onCompositionEnd(): void;

No documentation.

onBlur

protected onBlur(): void;

No documentation.

writeValue

writeValue(value: unknown): void;

A value set by the form (setValue, patchValue, reset): written to the View when it differs from the field's.

registerOnChange

registerOnChange(fn: (value: unknown) => void): void;

No documentation.

registerOnTouched

registerOnTouched(fn: () => void): void;

No documentation.

setDisabledState

setDisabledState(disabled: boolean): void;

No documentation.

validate

validate(_control?: AbstractControl): ValidationErrors | null;

{ runic: errors } while the View reports validation messages for the field.

registerOnValidatorChange

registerOnValidatorChange(fn: () => void): void;

No documentation.