Which @angular/* package(s) are relevant/related to the feature request?
core
Description
Currently, rxResource's request function doesn't support returning an Observable that can trigger the loader function when new values are emitted.
Workaround:
const dataService = inject(DataService);
const click$ = new Subject<MouseEvent>();
const click = toSignal(click$, { initialValue: null });
const data = rxResource({
request: click,
loader: ({ request }) =>
request ? dataService.getData() : of(null),
});
Proposed solution
Allow request to return an Observable, where each emission triggers the loader function:
const dataService = inject(DataService);
const click$ = new Subject<MouseEvent>();
const data = rxResource({
request: () => click$,
loader: () => dataService.getData(),
});
Benefits:
- More reactive control over loader triggers
- Better integration with event-based workflows
- Reduced boilerplate when working with Observables
Alternatives considered
_
Which @angular/* package(s) are relevant/related to the feature request?
core
Description
Currently,
rxResource'srequestfunction doesn't support returning an Observable that can trigger the loader function when new values are emitted.Workaround:
Proposed solution
Allow
requestto return an Observable, where each emission triggers the loader function:Benefits:
Alternatives considered
_