RenderSpecComponent
The top-level entry point for rendering a @json-render/core spec as an Angular component tree.
#Import
#Selector
#Usage
#Inputs
| Input | Type | Default | Description |
|---|---|---|---|
spec | Spec | null | null | The json-render spec to render. When null, nothing is rendered. |
registry | AngularRegistry | undefined | undefined | Component registry mapping element types to Angular components. |
store | StateStore | undefined | undefined | State store for reactive prop resolution. |
functions | Record<string, ComputedFunction> | undefined | undefined | Computed functions for $fn prop expressions. |
handlers | Record<string, (params: Record<string, unknown>) => unknown | Promise<unknown>> | undefined | undefined | Event handlers invoked when components call emit(). |
loading | boolean | false | Whether the spec is currently streaming. Passed to all rendered components as the loading input. |
#Resolution Chain
For registry, store, functions, and handlers, the component resolves values using this priority:
Values passed as component inputs.
Global defaults provided via provideRender().
For store: an internal signalStateStore() is created from spec.state (or an empty object). For registry: an empty registry is used (no components resolve).
This means you can set defaults globally and override them per-instance:
#RENDER_CONTEXT
RenderSpecComponent provides a RENDER_CONTEXT injection token to its children via viewProviders. This context is consumed by RenderElementComponent instances and contains:
The context is a computed signal that updates when any input or config changes. Child components can inject it directly:
#Template Behavior
The component renders a single <render-element> for the root element key from spec.root:
When spec is null or has no root, nothing is rendered.
#Internal Store Behavior
When no store is provided (neither as input nor via RENDER_CONFIG), the component lazily creates an internal signalStateStore() from spec.state. This internal store is created once and reused across spec changes -- it is not recreated when the spec input updates.
#Change Detection
The component uses ChangeDetectionStrategy.OnPush. All reactive updates flow through Angular Signals, ensuring efficient change detection without zone-based triggers.