defineAngularRegistry()
Creates an AngularRegistry that maps element type names to Angular component classes.
#Import
#Signature
#Parameters
| Parameter | Type | Description |
|---|---|---|
componentMap | Record<string, AngularComponentRenderer | RenderViewEntry> | An object mapping type name strings to Angular component classes, or to { component, fallback? } objects |
AngularComponentRenderer is defined as Type<unknown> -- any Angular component class. Each entry can be a bare component class or a RenderViewEntry object:
Use the object form to configure a custom per-entry fallback (see Per-Component Fallbacks below). A bare component class is shorthand for { component } paired with the library's default fallback.
#Returns
An AngularRegistry object with a single entry accessor:
| Method | Description |
|---|---|
getEntry(name) | Returns the fully-normalized entry for a registered name, or undefined if not registered. The component, the resolved fallback (the entry's own or the library default), and any optional schema/description all hang off the returned object. |
names() | Returns an array of all registered type name strings |
#Usage
#Basic Registry
#With provideRender()
#As a Component Input
#Per-Component Fallbacks
Each entry can be a bare component class or a { component, fallback } object. The fallback mounts while any state-bound prop on the element is still unresolved -- useful for streaming UI, where structure arrives before data:
An entry that omits fallback -- including every bare-component entry like Text above -- falls back to the library's DefaultFallbackComponent. Once the real component mounts, the choice is monotonic for that element instance: a later prop resolving to undefined never reverts it to the fallback.
#Internal Behavior
The function normalizes each input entry into a NormalizedEntry ({ component, fallback, schema?, description? }) and stores them in an internal Map for O(1) lookups. A bare component class is paired with DefaultFallbackComponent; an object entry keeps its own fallback (or the default) and preserves any schema/description:
The registry is immutable after creation. To add or remove components, create a new registry with the updated component map. The internal Map is created once and not exposed for mutation.
#Type Name Conventions
Type names in the registry must match the type field in your spec elements exactly (case-sensitive):
#Related
- Component Registry Guide -- full guide on creating registries and the component input contract
- AngularComponentInputs -- the standard input interface for rendered components
- provideRender() -- setting a global registry