Skip to main content

getting-started

Create an Angular TanStack Table v9 table with injectTable inside injection context, explicit stable tableFeatures and columns, signal-backed data, and FlexRender structural directives or helpers.

설치로 이동

소스 정보

저장소
TanStack/table
최근 소스 활동
2026년 8월 28일 17:37
감지된 SKILL.md 언어
영어
스타
28,448
포크
3,577

설치 방법

기본적으로 소스를 먼저 확인하는 Prompt가 선택됩니다. 직접 명령으로 전환하거나 로컬 사본을 다운로드할 수도 있습니다.

소스 파일 검토

설치 여부를 결정하기 전에 SKILL.md와 SkillsMP에 표시된 보조 파일을 읽어 보세요.

SKILL.md 표시 중

SKILL.md
소스 지침 · 읽기 전용 미리보기
name
getting-started
description
Create an Angular TanStack Table v9 table with injectTable inside injection context, explicit stable tableFeatures and columns, signal-backed data, and FlexRender structural directives or helpers.
metadata
{"type":"framework","library":"@tanstack/angular-table","framework":"angular","library_version":"9.2.4"}
requires
["@tanstack/table-core#core","@tanstack/table-core#table-features"]
sources
["TanStack/table:docs/framework/angular/guide/migrating.md","TanStack/table:docs/framework/angular/guide/rendering.md","TanStack/table:examples/angular/basic-inject-table","TanStack/table:packages/angular-table/src/index.ts"]
This skill builds on `@tanstack/table-core#core` and `@tanstack/table-core#table-features`. Read them first for the headless model and explicit features. ## Setup ```ts import { Component, signal } from '@angular/core' import { FlexRender, injectTable, tableFeatures } from '@tanstack/angular-table' type Person = { name: string; age: number } const features = tableFeatures({}) const columns = [ { accessorKey: 'name', header: 'Name' }, { accessorKey: 'age', header: 'Age' }, ] @Component({ selector: 'app-table', imports: [FlexRender], template: `<table> <tbody> @for (row of table.getRowModel().rows; track row.id) { <tr> @for (cell of row.getAllCells(); track cell.id) { <td> <ng-container *flexRenderCell="cell; let value">{{ value }}</ng-container> </td> } </tr> } </tbody> </table>`, }) export class TableComponent { readonly data = signal<Person[]>([{ name: 'Ada', age: 36 }]) readonly table = injectTable(() => ({ features, columns, data: this.data() })) } ``` ## Core Patterns ### Keep static inputs outside the initializer `injectTable` reruns its options initializer when a signal read changes. Define features, row-model factories, and columns at module or stable class scope; read only changing values inside. ### Render each content kind correctly Import `FlexRender` for `*flexRender`, `*flexRenderCell`, `*flexRenderHeader`, and `*flexRenderFooter`. Definitions may yield primitives, `TemplateRef`, component types, or `flexRenderComponent(...)`; Table does not supply markup or CSS. ## Common Mistakes ### CRITICAL Calling injectTable outside DI Wrong: ```ts export function makeTable() { return injectTable(() => ({ features, columns, data })) } ``` Correct: ```ts export class TableComponent { readonly table = injectTable(() => ({ features, columns, data: this.data() })) } ``` `injectTable` asserts an Angular injection context and registers lifecycle cleanup there. Source: `packages/angular-table/src/injectTable.ts` ### HIGH Reallocating static options reactively Wrong: ```ts injectTable(() => ({ features: tableFeatures({}), columns: makeColumns(), data: this.data(), })) ``` Correct: ```ts const features = tableFeatures({}) const columns = makeColumns() injectTable(() => ({ features, columns, data: this.data() })) ``` Every signal change reruns the initializer; rebuilding static inputs invalidates memoized Table work. Source: `packages/angular-table/src/injectTable.ts` ### HIGH Treating a render function as a component Wrong: ```ts cell: () => flexRenderComponent(() => 'value') ``` Correct: ```ts cell: () => 'value' ``` `flexRenderComponent` wraps an Angular component type; ordinary functions and primitives are handled directly by FlexRender. Source: `docs/framework/angular/guide/rendering.md` ## API Discovery Inspect `node_modules/@tanstack/angular-table/dist/types/` for the bundled public API; inspect optional feature APIs in installed `@tanstack/table-core/dist/features/`.
GitHub에서 보기