TanStack
API Reference

toResource

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

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

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

Warning: experimental feature. The API may change in minor and patch releases. Pin your package version to an exact version when using this feature.

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