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

provideAngularQuery.md

64 lines1.2 KB

1---
2id: provideAngularQuery
3title: provideAngularQuery
4---
5​
6# Function: provideAngularQuery()
7​
8```ts
9function provideAngularQuery(queryClient): EnvironmentProviders
10```
11​
12Sets up providers necessary to enable TanStack Query functionality for Angular applications.
13​
14Allows to configure a `QueryClient`.
15​
16**Example - standalone**
17​
18```ts
19import {
20 provideAngularQuery,
21 QueryClient,
22} from '@tanstack/angular-query-experimental'
23​
24bootstrapApplication(AppComponent, {
25 providers: [provideAngularQuery(new QueryClient())],
26})
27```
28​
29**Example - NgModule-based**
30​
31```ts
32import {
33 provideAngularQuery,
34 QueryClient,
35} from '@tanstack/angular-query-experimental'
36​
37@NgModule({
38 declarations: [AppComponent],
39 imports: [BrowserModule],
40 providers: [provideAngularQuery(new QueryClient())],
41 bootstrap: [AppComponent],
42})
43export class AppModule {}
44```
45​
46## Parameters
47​
48β€’ **queryClient**: `QueryClient`
49​
50A `QueryClient` instance.
51​
52## Returns
53​
54`EnvironmentProviders`
55​
56A set of providers to set up TanStack Query.
57​
58## See
59​
60https://tanstack.com/query/v5/docs/framework/angular/quick-start
61​
62## Defined in
63​
64[providers.ts:50](https://github.com/TanStack/query/blob/27861961bbb36e9bc25fcd45cff21b5645f02f9b/packages/angular-query-experimental/src/providers.ts#L50)