Skip to content
Source
Sign inSign up
TanStack/query
Open History to see the last commit

toResource.md

45 lines1.4 KB

function toResource<TValue>(query: QueryResourceSource<TValue>): QueryResource<TValue>;

Defined in: packages/angular-query/src/query-resource.ts:41

Converts an Angular Query result into Angular's Resource interface.

Call this function once and reuse the returned resource.

Type Parameters

TValue

TValue

Parameters

query

QueryResourceSource<TValue>

An Angular Query or infinite-query result.

Returns

QueryResource<TValue>

A Resource-compatible view of the query result.

Result properties

PropertyModifierTypeDescriptionOverrides
reloadpublic() => booleanRequests a new query fetch only when the current query data is stale. Used for compatibility with Angular APIs that might want to reload a resource, like Signal Forms' validateAsync resource interface.-
snapshotreadonlySignal<ResourceSnapshot<TValue>>The current query state as a single snapshot.Resource.snapshot