0
Fork 0
mirror of https://github.com/TanStack/query.git synced 2026-11-16 22:50:20 +00:00
query/examples/angular/devtools-panel-angular-router/README.md
Wonsuk Choi 70441f460d
docs(examples): rewrite the READMEs, add the framework or router to example titles, and rename examples to '<feature>-<framework>' (#12583)
* docs(examples): describe each example in its README with a summary, the framework it is built with, how it works and the npm commands

* docs(examples): add the framework or router to the README heading and page title of examples that have variants

* docs(examples/react): rename the Next.js examples to '<feature>-nextjs-<pages|app>-router'

* docs(examples/react): update package names, docs links and labels, and the lockfile for the renamed Next.js examples

* docs(examples): rename 'svelte/sveltekit', 'solid/solid-start-streaming' and 'angular/router' to '<feature>-<framework>'

* docs(examples): correct README details on staleness, hydration, 'hasMore', streaming and dependent queries, and prefetch on 'focusin' in 'vue/prefetching-nuxt4'
2026-11-12 16:58:15 +09:00

1.2 KiB

TanStack Angular Query Devtools Panel Example (Angular Router)

Embeds the devtools as a panel inside the page instead of the floating toggle.

Built with Angular Router.

How it works

  • src/app/services/repos/queries.ts is an @Injectable ReposQueries whose detail() returns queryOptions that fetch the TanStack/query repository with HttpClient and lastValueFrom.
  • src/app/components/example-query.component.ts reads it with injectQuery(() => this.#reposQueries.detail()) and is rendered on both routes.
  • src/app/components/basic-devtools-panel-example.component.ts calls injectDevtoolsPanel with the <div> from viewChild as hostElement, so the panel mounts in that <div> while it is open.
  • src/app/components/lazy-load-devtools-panel-example.component.ts imports @tanstack/angular-query-experimental/devtools-panel in an effect only the first time the panel is opened, then calls injectDevtoolsPanel with the component's Injector.
  • src/app/app.routes.ts lazy loads the two examples at basic and lazy with loadComponent, and src/app/app.config.ts registers provideTanStackQuery without withDevtools().

To run this example:

  • npm install
  • npm start