# injectStream

> **Function** in `@langchain/angular`

📖 [View in docs](https://reference.langchain.com/javascript/langchain-angular/injectStream)

Angular entry point for the v2-native stream runtime.

Call from a component, directive, or service field initializer to
attach an StreamApi bound to the current DestroyRef:

```ts
@Component({ template: `<div>{{ stream.messages() | json }}</div>` })
export class Chat {
  readonly stream = injectStream({
    assistantId: "agent",
    apiUrl: "http://localhost:2024",
  });
}
```

When called with no arguments, looks up a shared `StreamApi`
previously registered via provideStream. Throws if no
ancestor provider exists.

Must always run inside an Angular injection context.

## Signature

```javascript
injectStream<T = Record<string, unknown>, InterruptType = unknown, ConfigurableType extends object = Record<string, unknown>>(): StreamApi<T, InterruptType, ConfigurableType>
```

## Returns

`StreamApi<T, InterruptType, ConfigurableType>`

---

[View source on GitHub](https://github.com/langchain-ai/langgraphjs/blob/afb42cd7fe7a461c9d19be8f81603865fc26b66f/libs/sdk-angular/src/inject-stream.ts#L36)