本文へスキップ
Skillpedia
WebサイトとUI(フロントエンド)29k · #9808

getting-started

できること

このスキルは、TanStack Tableを使ってAngularアプリに表を作る方法を示します。列とデータの定義から、行の表示までを扱います。表のレイアウトを自分で作りたいAngularの開発者向けです。

使う場面

  • ✓記録の一覧を表示するAngularのコンポーネントを作っているとき。
  • ✓Angularの表のデータがシグナルから来ており、画面で更新される必要があるとき。
  • ✓AngularのテーブルにQueryやVirtualの機能を追加したいとき。

スキルのリンク

https://github.com/TanStack/table/blob/main/packages/angular-table/skills/getting-started/SKILL.md

コピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。

使い方

いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。

貼り付け用メッセージ

このスキルを使って手伝ってください:https://github.com/TanStack/table/blob/main/packages/angular-table/skills/getting-started/SKILL.md このリンクのSKILL.mdファイルを読んで、私の作業でその指示に従ってください。
こういうスキルを、AIが自分で見つけてくれたら?無料のSkillpedia MCPをインストール。1行で、作業の前に15,000+のスキルから探してくれます。1分でインストール →

AIへの頼み方の例

“Angularのアプリに、注文の一覧を表示する表が必要です。どう設定すればよいでしょうか。”

毎週5つの新しいスキル。1分で読めます。

仕組み

コンポーネントの中でinjectTableを呼び出し、列とデータを渡す方法を説明します。そのうえで、FlexRenderのディレクティブを使って、テンプレートで行をループさせます。

技術的な内容(元のSKILL.md)

作者による元のテキスト(英語)をGitHubからそのまま表示しています。

Load intent load @tanstack/table-core#core first for the headless model, stable inputs, and column inference.

Setup

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() }))
}

Construction and rendering

Call injectTable in a component, directive, or service field initializer, or another valid Angular injection context. The adapter binds its cleanup to that context.

Signals read in the options initializer rerun it and call setOptions. Keep features, factories, and columns outside the initializer; return stable data references and derive transformed data with computed outside it.

Import FlexRender for *flexRender, *flexRenderCell, *flexRenderHeader, and *flexRenderFooter. Render values can be primitives, TemplateRef, component types, or flexRenderComponent(...). Use flexRenderComponent for Angular component types; ordinary render functions are already supported directly.

Read for the task

  • When adding or configuring optional features, load intent load @tanstack/table-core#table-features and read only references for the requested behavior.
  • For state ownership or reactive reads, read table-state.
  • When tables share features, defaults, or reusable UI, read create-table-hook.
  • When Query supplies data or server processing, read with-tanstack-query.
  • When virtualizing rows or columns, read with-tanstack-virtual.
  • When upgrading v8 code, read migrate-v8-to-v9.

API discovery

Inspect node_modules/@tanstack/angular-table/dist/types/ for the bundled public declarations. Inspect feature APIs under node_modules/@tanstack/table-core/dist/features/.

よくある質問

injectTableはどこで呼び出すべきですか?

コンポーネントかサービスのフィールド、または別の有効なAngularのインジェクションのコンテキストの中で、後片付けが自動的に行われるようにします。

データがシグナルの場合はどうなりますか?

シグナルが変わると、オプションが再実行されるので、表は新しい値に更新されます。

列はコンポーネントの外で定義すべきですか?

スキルは、更新のたびに作り直されないよう、機能と列をリアクティブなオプションの外に置くことを勧めています。

詳細

作者による元の説明

Create and render Table v9 with the angular adapter. Route reusable createTableHook components, Query and Virtual integration, and framework setup; use table-state for reactive ownership.

repo: TanStack/table

人気

GitHubのスター
29k
ランキング
#9808
ライセンス
MIT
更新日
2026/10/21

このスキルは役に立ちますか?

0

ログイン して投票しましょう。

コメント

  • …

このリポジトリの他のスキル

似ているスキル