CngxError
projects/forms/field/error.directive.ts
Import#
import { CngxError } from '@cngx/forms/field'
Description#
Marks a manual error container inside a cngx-form-field.
Use this when you want full control over error rendering.
For automatic error rendering from a message registry, use CngxFieldErrors instead.
The container is always in the DOM. aria-hidden toggles based on the showError gate
(touched AND invalid), and the presenter references the container in the input's
aria-describedby only while the error is shown - a directly referenced node lands in
the accessible description even when aria-hidden (accname 1.2 ยง2A), so the reference
itself is the gate. role="alert" ensures screen readers announce errors.
<div cngxError>
@if (presenter.errors(); as errors) {
@for (e of errors; track e.kind) {
<span>{{ e.message }}</span>
}
}
</div>