If your Angular project is using signals but there’s a library or module with observable you need to use, you can convert it to signal using toSignal.
In the example below, interval rxjs function returns an observable that emits numbers incrementally every 1s (specified as 1000). The signal is used in effect where every time the observable emits a number, the number gets logged. Note the use of the injector. This is important so Angular’s change detection system knows about this to avoid memory leaks.
// ...
injector = inject(Injector);
// ...
const nums$ = interval(1000);
const nums = toSignal(nums$, {
injector: this.injector,
});
effect(
() => {
console.log("nums", nums());
},
{
injector: this.injector,
},
);