Open History to see the last commit
1---
2id: toResource
3title: toResource
4---
5β
6<!-- DO NOT EDIT: this page is autogenerated from the type comments -->
7β
8```ts
9function toResource<TValue>(query: QueryResourceSource<TValue>): QueryResource<TValue>;
10```
11β
12Defined in: [packages/angular-query/src/query-resource.ts:44](https://github.com/TanStack/query/blob/main/packages/angular-query/src/query-resource.ts#L44)
13β
14Converts an Angular Query result into Angular's Resource interface.
15β
16Warning: experimental feature. The API may change in minor and patch releases.
17Pin your package version to an exact version when using this feature.
18β
19Call this function once and reuse the returned resource.
20β
21## Type Parameters
22β
23### TValue
24β
25`TValue`
26β
27## Parameters
28β
29### query
30β
31`QueryResourceSource`\<`TValue`\>
32β
33An Angular Query or infinite-query result.
34β
35## Returns
36β
37[`QueryResource`](../interfaces/QueryResource.md)\<`TValue`\>
38β
39A Resource-compatible view of the query result.
40β
41<a id="result-properties"></a>
42β
43### Result properties
44β
45| Property | Modifier | Type | Description | Overrides |
46| ------ | ------ | ------ | ------ | ------ |
47| <a id="result-property-reload"></a> `reload` | `public` | () => `boolean` | Requests 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. | - |
48| <a id="result-property-snapshot"></a> `snapshot` | `readonly` | `Signal`\<`ResourceSnapshot`\<`TValue`\>\> | The current query state as a single snapshot. | `Resource.snapshot` |