- Angular Reference
- Functions / defaultShouldDehydrateMutation
- Functions / defaultShouldDehydrateQuery
- Functions / dehydrate
- Functions / dehydrateQuery
- Functions / experimental_streamedQuery
- Functions / hashKey
- Functions / hydrate
- Functions / infiniteQueryOptions
- Functions / injectInfiniteQuery
- Functions / injectIsFetching
- Functions / injectIsMutating
- Functions / injectIsRestoring
- Functions / injectMutation
- Functions / injectMutationState
- Functions / injectQuery
- Functions / injectQueryClient
- Functions / isCancelledError
- Functions / keepPreviousData
- Functions / matchMutation
- Functions / matchQuery
- Functions / mutationOptions
- Functions / noop
- Functions / partialMatchKey
- Functions / provideAngularQuery
- Functions / provideIsRestoring
- Functions / provideQueryClient
- Functions / provideTanStackQuery
- Functions / queryFeature
- Functions / queryOptions
- Functions / replaceEqualDeep
- Functions / shouldThrowError
- Classes / CancelledError
- Classes / InfiniteQueryObserver
- Classes / Mutation
- Classes / MutationCache
- Classes / MutationObserver
- Classes / QueriesObserver
- Classes / Query
- Classes / QueryCache
- Classes / QueryClient
- Classes / QueryObserver
- Interfaces / BaseMutationNarrowing
- Interfaces / BaseQueryNarrowing
- Interfaces / CancelOptions
- Interfaces / CreateBaseQueryOptions
- Interfaces / CreateInfiniteQueryOptions
- Interfaces / CreateMutationOptions
- Interfaces / CreateQueryOptions
- Interfaces / DefaultOptions
- Interfaces / DehydrateOptions
- Interfaces / DehydratedState
- Interfaces / EnsureQueryDataOptions
- Interfaces / FetchNextPageOptions
- Interfaces / FetchPreviousPageOptions
- Interfaces / FetchQueryOptions
- Interfaces / FocusManager
- Interfaces / HydrateOptions
- Interfaces / InfiniteData
- Interfaces / InfiniteQueryObserverBaseResult
- Interfaces / InfiniteQueryObserverLoadingErrorResult
- Interfaces / InfiniteQueryObserverLoadingResult
- Interfaces / InfiniteQueryObserverOptions
- Interfaces / InfiniteQueryObserverPendingResult
- Interfaces / InfiniteQueryObserverPlaceholderResult
- Interfaces / InfiniteQueryObserverRefetchErrorResult
- Interfaces / InfiniteQueryObserverSuccessResult
- Interfaces / InfiniteQueryPageParamsOptions
- Interfaces / InitialPageParam
- Interfaces / InjectInfiniteQueryOptions
- Interfaces / InjectIsFetchingOptions
- Interfaces / InjectIsMutatingOptions
- Interfaces / InjectMutationOptions
- Interfaces / InjectMutationStateOptions
- Interfaces / InjectQueryOptions
- Interfaces / InvalidateOptions
- Interfaces / InvalidateQueryFilters
- Interfaces / MutateOptions
- Interfaces / MutationCacheConfig
- Interfaces / MutationFilters
- Interfaces / MutationObserverBaseResult
- Interfaces / MutationObserverErrorResult
- Interfaces / MutationObserverIdleResult
- Interfaces / MutationObserverLoadingResult
- Interfaces / MutationObserverOptions
- Interfaces / MutationObserverSuccessResult
- Interfaces / MutationOptions
- Interfaces / MutationState
- Interfaces / NotifyEvent
- Interfaces / OnlineManager
- Interfaces / QueriesObserverOptions
- Interfaces / QueryCacheConfig
- Interfaces / QueryClientConfig
- Interfaces / QueryExecuteOptions
- Interfaces / QueryFeature
- Interfaces / QueryFilters
- Interfaces / QueryObserverBaseResult
- Interfaces / QueryObserverLoadingErrorResult
- Interfaces / QueryObserverLoadingResult
- Interfaces / QueryObserverOptions
- Interfaces / QueryObserverPendingResult
- Interfaces / QueryObserverPlaceholderResult
- Interfaces / QueryObserverRefetchErrorResult
- Interfaces / QueryObserverSuccessResult
- Interfaces / QueryOptions
- Interfaces / QueryState
- Interfaces / RefetchOptions
- Interfaces / RefetchQueryFilters
- Interfaces / Register
- Interfaces / ResetOptions
- Interfaces / ResultOptions
- Interfaces / SetDataOptions
- Interfaces / TimeoutManager
- Types / AnyDataTag
- Types / CreateBaseMutationResult
- Types / CreateBaseQueryResult
- Types / CreateInfiniteQueryResult
- Types / CreateMutateAsyncFunction
- Types / CreateMutateFunction
- Types / CreateMutationResult
- Types / CreateQueryResult
- Types / DataTag
- Types / DefaultError
- Types / DefaultedInfiniteQueryObserverOptions
- Types / DefaultedQueryObserverOptions
- Types / DefinedCreateInfiniteQueryResult
- Types / DefinedCreateQueryResult
- Types / DefinedInfiniteQueryObserverResult
- Types / DefinedInitialDataInfiniteOptions
- Types / DefinedInitialDataOptions
- Types / DefinedQueryObserverResult
- Types / DevtoolsFeature
- Types / DistributiveOmit
- Types / EnsureInfiniteQueryDataOptions
- Types / FetchInfiniteQueryOptions
- Types / FetchStatus
- Types / GetNextPageParamFunction
- Types / GetPreviousPageParamFunction
- Types / InferDataFromTag
- Types / InferErrorFromTag
- Types / InfiniteQueryExecuteOptions
- Types / InfiniteQueryObserverResult
- Types / InitialDataFunction
- Types / ManagedTimerId
- Types / MutateFunction
- Types / MutateFunctionRest
- Types / MutationCacheNotifyEvent
- Types / MutationFunction
- Types / MutationFunctionContext
- Types / MutationKey
- Types / MutationMeta
- Types / MutationObserverResult
- Types / MutationScope
- Types / MutationStatus
- Types / NetworkMode
- Types / NonUndefinedGuard
- Types / NotifyEventType
- Types / NotifyOnChangeProps
- Types / OmitKeyof
- Types / Override
- Types / PersistQueryClientFeature
- Types / PlaceholderDataFunction
- Types / QueriesOptions
- Types / QueriesPlaceholderDataFunction
- Types / QueriesResults
- Types / QueryBooleanOption
- Types / QueryCacheNotifyEvent
- Types / QueryFeatures
- Types / QueryFunction
- Types / QueryFunctionContext
- Types / QueryKey
- Types / QueryKeyHashFunction
- Types / QueryKeyWithDataTag
- Types / QueryMeta
- Types / QueryObserverResult
- Types / QueryPersister
- Types / QueryStatus
- Types / SkipToken
- Types / StaleTime
- Types / StaleTimeFunction
- Types / ThrowOnError
- Types / TimeoutCallback
- Types / TimeoutProvider
- Types / UndefinedInitialDataInfiniteOptions
- Types / UndefinedInitialDataOptions
- Types / UnsetMarker
- Types / UnusedSkipTokenInfiniteOptions
- Types / UnusedSkipTokenOptions
- Types / Updater
- Types / WithRequired
- Types / dataTagErrorSymbol
- Types / dataTagSymbol
- Variables / dataTagErrorSymbol
- Variables / dataTagSymbol
- Variables / defaultScheduler
- Variables / environmentManager
- Variables / focusManager
- Variables / isServer
- Variables / notifyManager
- Variables / onlineManager
- Variables / skipToken
- Variables / timeoutManager
- Variables / unsetMarker
provideTanStackQuery
function provideTanStackQuery(queryClient:
| QueryClient
| InjectionToken<QueryClient>, ...features: QueryFeatures[]): Provider[];Defined in: packages/angular-query-experimental/src/providers.ts:96
Sets up providers necessary to enable TanStack Query functionality for Angular applications. Allows configuring a QueryClient and optional features such as developer tools.
Parameters#
queryClient#
| QueryClient | InjectionToken<QueryClient>
A QueryClient instance, or an InjectionToken which provides a QueryClient.
features#
...QueryFeatures[]
Optional features to configure additional Query functionality.
Returns#
Provider[]
A set of providers to set up TanStack Query.
See#
- https://tanstack.com/query/v5/docs/framework/angular/quick-start
- withDevtools
Examples#
import { provideTanStackQuery, QueryClient } from '@tanstack/angular-query-experimental'
bootstrapApplication(AppComponent, {
providers: [provideTanStackQuery(new QueryClient())],
})The same, in an NgModule-based application:
import { provideTanStackQuery, QueryClient } from '@tanstack/angular-query-experimental'
@NgModule({
declarations: [AppComponent],
imports: [BrowserModule],
providers: [provideTanStackQuery(new QueryClient())],
bootstrap: [AppComponent],
})
export class AppModule {}Enabling optional developer tools by adding withDevtools — by default, the tools are then loaded when your app is in development mode:
import {
provideTanStackQuery,
withDevtools,
QueryClient,
} from '@tanstack/angular-query-experimental'
bootstrapApplication(AppComponent, {
providers: [provideTanStackQuery(new QueryClient(), withDevtools())],
})Using an InjectionToken for the QueryClient — an advanced optimization that lets TanStack Query be absent from the main application bundle, useful for including it on lazy-loaded routes only while still sharing a QueryClient. This is a small optimization; for most applications it's preferable to provide the QueryClient in the main application config, as in the examples above:
export const MY_QUERY_CLIENT = new InjectionToken('', {
factory: () => new QueryClient(),
})
// In a lazy loaded route or lazy loaded component's providers array:
providers: [provideTanStackQuery(MY_QUERY_CLIENT)]