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
History 2026-11-14 02:55:47 +09:00
..
.devcontainer docs(examples): add router and framework suffix to example directories to match their 'package.json' names (#12473) 2026-11-01 19:39:04 +09:00
public docs(examples): use the TanStack Query emblem as the favicon in every example (#12578) 2026-11-12 13:33:29 +09:00
src docs(examples): rewrite the READMEs, add the framework or router to example titles, and rename examples to '<feature>-<framework>' (#12583) 2026-11-12 16:58:15 +09:00
.gitignore docs(examples): use each framework's template '.gitignore' in every example (#12592) 2026-11-13 10:57:29 +09:00
angular.json docs(examples/angular): align 'angular.json', root components, 'OnPush', mock interceptors and 'tsconfig' across the examples (#12593) 2026-11-14 02:55:47 +09:00
eslint.config.js docs(examples): add router and framework suffix to example directories to match their 'package.json' names (#12473) 2026-11-01 19:39:04 +09:00
package.json ci: Version Packages (#12543) 2026-11-07 00:00:45 +01:00
README.md docs(examples): rewrite the READMEs, add the framework or router to example titles, and rename examples to '<feature>-<framework>' (#12583) 2026-11-12 16:58:15 +09:00
tsconfig.app.json docs(examples/angular): align 'angular.json', root components, 'OnPush', mock interceptors and 'tsconfig' across the examples (#12593) 2026-11-14 02:55:47 +09:00
tsconfig.json docs(examples): add router and framework suffix to example directories to match their 'package.json' names (#12473) 2026-11-01 19:39:04 +09:00

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