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:41](https://github.com/TanStack/query/blob/main/packages/angular-query/src/query-resource.ts#L41)
13β
14Converts an Angular Query result into Angular's Resource interface.
15β
16Call this function once and reuse the returned resource.
17β
18## Type Parameters
19β
20### TValue
21β
22`TValue`
23β
24## Parameters
25β
26### query
27β
28`QueryResourceSource`\<`TValue`\>
29β
30An Angular Query or infinite-query result.
31β
32## Returns
33β
34[`QueryResource`](../interfaces/QueryResource.md)\<`TValue`\>
35β
36A Resource-compatible view of the query result.
37β
38<a id="result-properties"></a>
39β
40### Result properties
41β
42| Property | Modifier | Type | Description | Overrides |
43| ------ | ------ | ------ | ------ | ------ |
44| <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. | - |
45| <a id="result-property-snapshot"></a> `snapshot` | `readonly` | `Signal`\<`ResourceSnapshot`\<`TValue`\>\> | The current query state as a single snapshot. | `Resource.snapshot` |