provideAngularQuery

Function: provideAngularQuery()

ts
function provideAngularQuery(queryClient): EnvironmentProviders
function provideAngularQuery(queryClient): EnvironmentProviders

Sets up providers necessary to enable TanStack Query functionality for Angular applications.

Allows to configure a QueryClient.

Example - standalone

ts
import {
  provideAngularQuery,
  QueryClient,
} from '@tanstack/angular-query-experimental'

bootstrapApplication(AppComponent, {
  providers: [provideAngularQuery(new QueryClient())],
})
import {
  provideAngularQuery,
  QueryClient,
} from '@tanstack/angular-query-experimental'

bootstrapApplication(AppComponent, {
  providers: [provideAngularQuery(new QueryClient())],
})

Example - NgModule-based

ts
import {
  provideAngularQuery,
  QueryClient,
} from '@tanstack/angular-query-experimental'

@NgModule({
  declarations: [AppComponent],
  imports: [BrowserModule],
  providers: [provideAngularQuery(new QueryClient())],
  bootstrap: [AppComponent],
})
export class AppModule {}
import {
  provideAngularQuery,
  QueryClient,
} from '@tanstack/angular-query-experimental'

@NgModule({
  declarations: [AppComponent],
  imports: [BrowserModule],
  providers: [provideAngularQuery(new QueryClient())],
  bootstrap: [AppComponent],
})
export class AppModule {}

Parameters

queryClient: QueryClient

A QueryClient instance.

Returns

EnvironmentProviders

A set of providers to set up TanStack Query.

See

https://tanstack.com/query/v5/docs/framework/angular/quick-start

Defined in

providers.ts:50