#title: views() description: Create and compose view registries for generative UI rendering
views()
Creates an immutable view registry mapping names to Angular components. Views are rendered inline in the chat when the agent produces a JSON spec.
#Usage
Pass to the chat component:
Or provide globally via DI:
#Composition
Compose registries via object spread. Last key wins for overrides:
#API
#views(map)
Creates a frozen ViewRegistry from a Record<string, Type<unknown>>.
| Parameter | Type | Description |
|---|---|---|
map | Record<string, Type<unknown>> | Name → Angular component mapping |
| Returns | ViewRegistry | Frozen immutable registry |
#withViews(base, additions)
Adds new views without overwriting existing entries. Existing keys in base are preserved.
#withoutViews(base, ...names)
Removes views by name:
#provideViews(registry)
Angular DI provider. Works at app level or route level:
#toRenderRegistry(registry)
Converts a ViewRegistry to the low-level AngularRegistry type used by <render-spec>. Called internally by the chat component — most developers won't need this.
#View Components
View components are standard Angular standalone components. They receive props as input() signals:
#How Specs Are Detected
The chat component checks each message for a ui field containing a valid spec:
The type in the spec is matched against the view registry to resolve the Angular component.