Skip to main content
cngx-src documentation

injectErrorAggregator

Functioncommon/interactive/errorv0.1.0

projects/common/interactive/error-registry/inject-error-aggregator.ts

Description#

Creates a programmatic CngxErrorAggregatorContract, optionally registered under name in the ambient CngxErrorRegistry.

Positional arguments - NOT a config-options-bag - per Pillar 3 (Komposition statt Konfiguration). When name is set and a registry is provided, auto-registers and auto-deregisters on the surrounding DestroyRef.

Signature#

injectErrorAggregator(name?: string, sources?: Record, scope?: CngxErrorScopeContract, labels?: Record)

Parameters#

@paramname?string

Optional registry name (skips registration when omitted).

@paramsources?Record

Initial source map (key → reactive boolean Signal). Each entry's signal is the live condition the aggregator reads on every recompute.

Optional scope override; when omitted, shouldShow collapses to hasError.

@paramlabels?Record

Optional human-readable labels by source key, used in errorLabels and announcement.

Must be called in an injection context (constructor, factory provider, runInInjectionContext).

Computed-graph derivation is delegated to createErrorAggregatorContract so the directive () and the function form share a single source of truth.

Returns#

CngxErrorAggregatorContract