provideChat()
provideChat is the provider factory that registers @ngaf/chat configuration in Angular's dependency injection system and starts the package license check. Call it in your ApplicationConfig or at the route level when you need a shared CHAT_CONFIG value.
#Signature
| Parameter | Type | Description |
|---|---|---|
config | ChatConfig | Configuration object with optional render registry, avatar label, assistant name, and license token |
Returns: EnvironmentProviders -- created via makeEnvironmentProviders(), compatible with bootstrapApplication, ApplicationConfig, and route-level providers.
#What It Does
provideChat() registers a single provider:
This makes the ChatConfig object available throughout the application via the CHAT_CONFIG injection token. provideChat() does not automatically wire generative UI into <chat>; pass [views], [store], and [handlers] directly to ChatComponent.
#CHAT_CONFIG Injection Token
The token is an InjectionToken<ChatConfig> that can be injected in any component, directive, or service:
Injecting CHAT_CONFIG without calling provideChat() will throw a NullInjectorError. Use inject(CHAT_CONFIG, { optional: true }) if your component should work without global configuration.
#Configuration Options
See the ChatConfig API reference for the full interface definition.
| Option | Type | Default | Description |
|---|---|---|---|
renderRegistry | AngularRegistry | undefined | Stored on CHAT_CONFIG for consumers that want a shared render registry. <chat> uses the [views] input directly. |
avatarLabel | string | "A" | Shared avatar label for consumers that inject CHAT_CONFIG |
assistantName | string | "Assistant" | Shared assistant display name for consumers that inject CHAT_CONFIG |
license | string | undefined | Signed license token used by the package license check |
#Usage Patterns
#Application-Wide Configuration
#Route-Level Configuration
Provide different chat configurations for different parts of your application:
#Without provideChat()
All chat components work without provideChat(). They use defaults:
- Avatar label:
"A" - Assistant name:
"Assistant" - Generative UI still requires the
[views]input onChatComponent