devtools
它能做什么
这项技能展示如何把 Angular 表格注册到 TanStack Devtools 面板中,使开发者在调试时能看到它们。内容涵盖设置、必需的键和清理。
适用场景
- ✓当你想在开发模式下运行应用时检查 Angular 表格的状态的时候。
- ✓当开发者工具面板没有显示某个表格,你需要检查其注册情况的时候。
- ✓当你希望开发者工具只在开发构建中启用的时候。
技能链接
https://github.com/TanStack/table/blob/main/packages/angular-table-devtools/skills/devtools/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“我如何让 Angular 表格在开发时显示在 TanStack 开发者工具面板中?”
每周 5 个新技能,1 分钟读完。
工作原理
它解释如何在 Angular 组件中调用注册辅助函数,为每个表格提供唯一的键,并开启或关闭注册。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
This skill builds on @tanstack/table-core#core and @tanstack/table-devtools#devtools.
Setup
import { Component } from '@angular/core'
import { injectTable, tableFeatures } from '@tanstack/angular-table'
import { injectTanStackTableDevtools } from '@tanstack/angular-table-devtools'
const features = tableFeatures({})
const columns = [{ accessorKey: 'id' }]
const data: Array<{ id: string }> = []
@Component({ selector: 'users-table', template: 'Users table registered' })
export class UsersTable {
readonly table = injectTable(() => ({
key: 'users-table',
features,
columns,
data,
}))
constructor() {
injectTanStackTableDevtools(() => ({ table: this.table }))
}
}
Provide the Angular TanStack Devtools host once at application configuration level as documented in docs/devtools.md.
Hooks and Components
The injector options function may return table: undefined or an enabled function to remove/disable registration reactively.
Common Mistakes
CRITICAL Injector called outside context
Wrong: call injectTanStackTableDevtools from an arbitrary callback after bootstrap.
Correct: call it in a component/service field initializer or constructor injection context.
The adapter uses Angular injection and effects for lifecycle cleanup.
Source: TanStack/table:packages/angular-table-devtools/src/injectTanStackTableDevtools.ts
HIGH Missing table key
Wrong: register an otherwise valid table without options.key.
Correct: assign a stable unique key before injection registration.
Core registration logs an error and skips keyless targets.
Source: TanStack/table:packages/table-devtools/src/tableTarget.ts
MEDIUM isDevMode no-op misunderstood
Wrong: expect default Angular exports to render production Devtools.
Correct: keep standard setup development-only; use /production only when explicitly requested.
The package index switches exports using Angular isDevMode().
Source: TanStack/table:packages/angular-table-devtools/src/index.ts
API Discovery
Inspect node_modules/@tanstack/angular-table-devtools/dist/index.d.ts and injectTanStackTableDevtools.d.ts for current injection options.
常见问题
注册代码必须放在哪里?
它必须在 Angular 注入上下文中运行,例如组件字段或构造函数中。
为什么每个表格都需要一个键?
选项要求提供键,这样才能在开发者工具面板中识别每个表格。
应用还需要额外的设置吗?
需要,正如文档所述,开发者工具宿主必须在应用配置层级提供一次。
详情
作者的原始描述
Register Angular Table v9 instances with injectTanStackTableDevtools inside injection context. Load for reactive table registration, required options.key, enabled or undefined tables, cleanup, Angular isDevMode gating, or explicit production exports.
repo: TanStack/table
热度
- GitHub 星标
- 29k
- 排名
- #9807
- 许可证
- MIT
- 更新时间
- 2026/10/21
评论
- …
同一仓库的更多技能
getting-started
29k教你的智能体如何在 Alpine.js 中使用 TanStack Table 构建并显示数据表格,涵盖设置、响应式数据和渲染行。
table-state
29k教你的智能体如何在 Alpine.js 中读取和控制表格状态,例如当前页码,使状态变化时屏幕能够更新。
getting-started
29k教你的智能体如何在 Angular 中创建并显示 TanStack 表格,涵盖 injectTable 设置、模板渲染和行数据的更新。
migrate-v8-to-v9
29k帮你的智能体把 Angular 表格从 TanStack Table v8 迁移到 v9,并依据迁移清单检查设置、渲染、状态和钩子。