defineAngularRegistry()
Creates an AngularRegistry that maps element type names to Angular component classes.
Import
Signature
Parameters
| Parameter | Type | Description |
|---|---|---|
componentMap | Record<string, AngularComponentRenderer> | An object mapping type name strings to Angular component classes |
AngularComponentRenderer is defined as Type<unknown> -- any Angular component class.
Returns
An AngularRegistry object with two methods:
| Method | Description |
|---|---|
get(name) | Returns the component class for the given type name, or undefined if not registered |
names() | Returns an array of all registered type name strings |
Usage
Basic Registry
With provideRender()
As a Component Input
Internal Behavior
The function converts the input object to an internal Map<string, AngularComponentRenderer> for O(1) lookups:
Immutable after creation
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