Open History to see the last commit
1import { ChangeDetectionStrategy, Component, signal } from '@angular/core'
2import { createCounter } from './counter'
3import type {
4 TanStackDevtoolsAngularInit,
5 TanStackDevtoolsAngularPlugin,
6} from '@tanstack/angular-devtools'
7import {
8 CustomDevtoolPanel,
9 customDevtoolPlugin,
10 noOpCustomDevtoolPlugin,
11} from './devtools/custom-devtools-panel'
12import { TanStackDevtools } from '@tanstack/angular-devtools'
13β
14@Component({
15 selector: 'app-root',
16 imports: [TanStackDevtools],
17 template: `
18 <div>
19 <h1>Custom plugins</h1>
20 <h2>Count: {{ counter.value() }}</h2>
21 <div style="display: flex; gap: 4px">
22 <button (click)="increment()">+ increase</button>
23 <button (click)="decrement()">β decrease</button>
24 </div>
25 </div>
26β
27 @defer (when true) {
28 <tanstack-devtools [plugins]="plugins()" [eventBusConfig]="{ debug: true }" />
29 }
30 `,
31 changeDetection: ChangeDetectionStrategy.OnPush,
32})
33export class App {
34 readonly plugins = signal<TanStackDevtoolsAngularPlugin[]>([
35 {
36 name: 'Custom devtools (Panel)',
37 render: CustomDevtoolPanel,
38 },
39 customDevtoolPlugin(),
40 // No-op plugin -> will not be rendered
41 noOpCustomDevtoolPlugin(),
42 ])
43β
44 readonly counter = createCounter()
45β
46 readonly increment = () => this.counter.increment()
47 readonly decrement = () => this.counter.decrement()
48}