injectProjection<
T
>(
registry: ChannelRegistry | Signal<ChannelRegistry | null | undefined> || Name | Type | Description |
|---|---|---|
registry* | ChannelRegistry | Signal<ChannelRegistry | null | undefined> | null | undefined | |
specFactory* | () => ProjectionSpec<T> | |
key* | string | Signal<string> | |
initialValue* | T |
Angular-side primitive that composes ChannelRegistry.acquire with Angular Signals + DestroyRef.
Contract (mirrors the React useProjection hook and the Vue
useProjection composable, but adapted to Angular's injection
context):
runInInjectionContext(...)).registry / key change) acquires a
ref-counted projection from the registry and subscribes to its
store. A computed view over the snapshot signal is returned.registry / key change) the previous
acquisition is released. If this was the last consumer of that
spec, the registry closes the underlying server subscription.registry is null/undefined the projection stays at
initialValue. This is the happy path for root-served
projections (injectMessages, injectToolCalls,
injectValues) which delegate to the always-on root snapshot
instead of acquiring a new registry projection.Reactive inputs: registry and key accept either a plain value
or a Signal so selector helpers can feed a computed target (e.g.
a subagent snapshot tracked on a signal) and rebind automatically.