diff --git a/adev/src/content/guide/signals/rxjs-interop.md b/adev/src/content/guide/signals/rxjs-interop.md index 66b170e7a1c..279d7cd44b7 100644 --- a/adev/src/content/guide/signals/rxjs-interop.md +++ b/adev/src/content/guide/signals/rxjs-interop.md @@ -28,6 +28,10 @@ Like the `async` pipe, `toSignal` subscribes to the Observable immediately, whic IMPORTANT: `toSignal` creates a subscription. You should avoid calling it repeatedly for the same Observable, and instead reuse the signal it returns. +### Injection context + +`toSignal` by default needs to run in an [injection context](guide/di/dependency-injection-context), such as during construction of a component or service. If an injection context is not available, you can manually specify the `Injector` to use instead. + ### Initial values Observables may not produce a value synchronously on subscription, but signals always require a current value. There are several ways to deal with this "initial" value of `toSignal` signals. diff --git a/aio/content/guide/rxjs-interop.md b/aio/content/guide/rxjs-interop.md index 7f14ab76de5..407837c9007 100644 --- a/aio/content/guide/rxjs-interop.md +++ b/aio/content/guide/rxjs-interop.md @@ -33,6 +33,10 @@ export class Ticker { Like the `async` pipe, `toSignal` subscribes to the Observable immediately, which may trigger side effects. The subscription created by `toSignal` automatically unsubscribes from the given Observable upon destruction of the component in which `toSignal` is called. +### Injection context + +`toSignal` by default needs to run in an [injection context](/guide/dependency-injection-context), such as during construction of a component or service. If an injection context is not available, an `Injector` can instead be explicitly specified. + ### Initial values Observables may not produce a value synchronously on subscription, but signals always require a current value. There are several ways to deal with this "initial" value of `toSignal` signals.