Bridge that projects an Angular httpResource() ref onto CngxAsyncState<T>
fromHttpResource
Functioncommon/data/async-state
projects/common/data/async-state/from-http-resource.ts
Description#
Bridge that projects an Angular httpResource() ref onto CngxAsyncState<T>.
Identical to fromResource but additionally maps the HTTP progress
signal to CngxAsyncState.progress (0–100 scale).
Must be called in an injection context.
private readonly res = httpResource<Item[]>(() => ({
url: '/api/items',
params: { q: this.filter() },
}));
readonly items = fromHttpResource(this.res);
// items.progress() tracks upload/download progress
// <cngx-progress [state]="items"> — auto-wired progress bar