Open History to see the last commit
1# TanStack Angular Query Dynamic Queries Example
2β
3A list of items where each item has its own query. Adding or removing an item adds or removes its query.
4β
5## How it works
6β
7- `src/app/app.component.ts` keeps the items in a `signal` and maps them to query options inside `injectQueries(() => ({ queries: this.items().map(...) }))`, so the list of queries follows the signal.
8- Each query has the key `['item-details', item.id]` and a `queryFn` that resolves mock details after a short delay.
9- The template reads each result by index, for example `queries()[index].isPending()` and `queries()[index].data()`.
10- `src/app/app.config.ts` registers the `QueryClient` with `provideTanStackQuery` and `withDevtools()`.
11β
12To run this example:
13β
14- `npm install`
15- `npm start`