RxJS Interop
Priority: P1 (HIGH)
Principles
- •Async to Sync: Use
toSignalto convert Observables (HTTP, Events) to Signals for template rendering. - •Sync to Async: Use
toObservablewhen you need RxJS operators (debounce, switchMap) on a Signal. - •Auto-Unsubscribe:
toSignalautomatically unsubscribes. - •Cleanup: Use
takeUntilDestroyedfor manual subscriptions in injection contexts.
Guidelines
- •HTTP Requests:
- •GET:
http.get().pipe(...)->toSignal() - •POST/PUT: Trigger explicit subscribe() or lastValueFrom().
- •GET:
- •Race Conditions: Handle async loading states.
toSignalrequires aninitialValueor handlesundefined.