5.37.1 • Published 4 days ago

@tanstack/angular-query-experimental v5.37.1

Weekly downloads
-
License
MIT
Repository
github
Last release
4 days ago

TanStack Query Header

npm version npm license bundle size npm

Angular Query

IMPORTANT: This library is currently in an experimental stage. This means that breaking changes will happen in minor AND patch releases. Upgrade carefully. If you use this in production while in experimental stage, please lock your version to a patch-level version to avoid unexpected breaking changes.

Functions for fetching, caching and updating asynchronous data in Angular

Documentation

Visit https://tanstack.com/query/latest/docs/framework/angular/overview

Quick Features

  • Transport/protocol/backend agnostic data fetching (REST, GraphQL, promises, whatever!)
  • Auto Caching + Refetching (stale-while-revalidate, Window Refocus, Polling/Realtime)
  • Parallel + Dependent Queries
  • Mutations + Reactive Query Refetching
  • Multi-layer Cache + Automatic Garbage Collection
  • Paginated + Cursor-based Queries
  • Load-More + Infinite Scroll Queries w/ Scroll Recovery
  • Request Cancellation
  • Dedicated Devtools

Quick Start

Angular Query requires Angular 16.

  1. Install angular-query

    $ npm i @tanstack/angular-query-experimental
    # or
    $ pnpm add @tanstack/angular-query-experimental
    # or
    $ yarn add @tanstack/angular-query-experimental
    # or
    $ bun add @tanstack/angular-query-experimental
  2. Initialize Angular Query by adding provideAngularQuery to your application

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

    or in a NgModule-based app

    import { provideHttpClient } from '@angular/common/http'
    import {
    provideAngularQuery,
    QueryClient,
    } from '@tanstack/angular-query-experimental'
    
    @NgModule({
      declarations: [AppComponent],
      imports: [BrowserModule],
      providers: [provideAngularQuery(new QueryClient())],
      bootstrap: [AppComponent],
    })
  3. Inject query

    import { injectQuery } from '@tanstack/angular-query-experimental'
    import { Component } from '@angular/core'
    
    @Component({...})
    export class TodosComponent {
      info = injectQuery(() => ({ queryKey: ['todos'], queryFn: fetchTodoList }))
    }
  4. If you need to update options on your query dynamically, make sure to pass them as signals

    import { injectQuery } from '@tanstack/angular-query-experimental'
    import { signal, Component } from '@angular/core'
    
    @Component({...})
    export class TodosComponent {
      id = signal(1)
      enabled = signal(false)
    
      info = injectQuery(() => ({
        queryKey: ['todos', this.id()],
        queryFn: fetchTodoList,
        enabled: this.enabled(),
      }))
    }
5.37.1

4 days ago

5.36.1

6 days ago

5.36.0

9 days ago

5.35.6

9 days ago

5.35.5

11 days ago

5.35.4

11 days ago

5.35.3

14 days ago

5.35.1

16 days ago

5.34.2

17 days ago

5.35.0

16 days ago

5.34.1

18 days ago

5.32.1

21 days ago

5.33.0

21 days ago

5.32.0

29 days ago

5.31.0

30 days ago

5.30.0

1 month ago

5.29.0

2 months ago

5.28.12

2 months ago

5.28.13

2 months ago

5.28.9

2 months ago

5.28.8

2 months ago

5.28.6

2 months ago

5.28.4

2 months ago

5.28.2

2 months ago

5.27.5

2 months ago

5.27.4

2 months ago

5.27.3

2 months ago

5.27.1

2 months ago

5.28.0

2 months ago

5.26.3

2 months ago

5.26.2

3 months ago

5.26.1

3 months ago

5.26.0

3 months ago

5.25.0

3 months ago

5.24.8

3 months ago

5.24.7

3 months ago

5.24.6

3 months ago

5.24.5

3 months ago

5.24.2

3 months ago

5.24.1

3 months ago

5.22.2

3 months ago

5.22.1

3 months ago

5.22.0

3 months ago

5.21.7

3 months ago

5.21.4

3 months ago

5.21.2

3 months ago

5.20.5

3 months ago

5.20.4

3 months ago

5.20.2

3 months ago

5.19.1

3 months ago

5.20.1

3 months ago

5.18.2

4 months ago

5.19.0

4 months ago

5.18.1

4 months ago

5.18.0

4 months ago

5.17.19

4 months ago

5.17.17

4 months ago

5.17.14

4 months ago

5.17.15

4 months ago

5.17.12

4 months ago

5.17.10

4 months ago

5.17.9

4 months ago

5.17.8

5 months ago

5.17.7

5 months ago

5.17.6

5 months ago

5.17.4

5 months ago

5.17.3

5 months ago

5.17.1

5 months ago

5.17.0

5 months ago

5.15.5

5 months ago

5.15.4

5 months ago

5.16.1

5 months ago

5.16.0

5 months ago

5.15.2

5 months ago

5.15.1

5 months ago

5.15.0

5 months ago

5.14.6

5 months ago

5.14.2

5 months ago

5.14.1

5 months ago

5.14.0

5 months ago

5.13.4

5 months ago

5.12.1

6 months ago