mirror of
https://github.com/affaan-m/everything-claude-code.git
synced 2026-06-11 02:33:10 +08:00
Translated 85 skill sub-reference files to achieve full parity with the English source: - skills/angular-developer/references/ — 35 files (all references) - skills/remotion-video-creation/rules/ — 28 files (all rules) - skills/tinystruct-patterns/references/ — 5 files - skills/openclaw-persona-forge/references/ — 6 files - skills/skill-comply/prompts/ — 3 files - skills/lead-intelligence/agents/ — 4 files - skills/brand-voice/references/ — 1 file - skills/frontend-slides/ — 2 files - hooks/memory-persistence/README.md — 1 file English source parity: 0 missing files (excluding rules/zh/, internal docs, and experimental examples absent from zh-CN)
68 lines
2.2 KiB
Markdown
68 lines
2.2 KiB
Markdown
# ルートの定義
|
||
|
||
ルートは特定の URL パスに対してどのコンポーネントをレンダリングするかを定義するオブジェクトです。
|
||
|
||
## 基本設定
|
||
|
||
`Routes` 配列にルートを定義し、`appConfig` の `provideRouter` を使用して提供します。
|
||
|
||
```ts
|
||
// app.routes.ts
|
||
export const routes: Routes = [
|
||
{path: '', component: HomePage},
|
||
{path: 'admin', component: AdminPage},
|
||
];
|
||
|
||
// app.config.ts
|
||
export const appConfig: ApplicationConfig = {
|
||
providers: [provideRouter(routes)],
|
||
};
|
||
```
|
||
|
||
## URL パス
|
||
|
||
- **静的**:完全な文字列に一致します(例:`'admin'`)。
|
||
- **ルートパラメーター**:コロンが前置された動的セグメント(例:`'user/:id'`)。
|
||
- **ワイルドカード**:`**` を使用して任意の URL に一致します。「見つかりません」ページに有用です。**常に配列の最後に配置してください。**
|
||
|
||
## マッチング戦略
|
||
|
||
Angular は**先勝ち**戦略を使用します。具体的なルートは具体性の低いルートより前に記述する必要があります。
|
||
|
||
## リダイレクト
|
||
|
||
`redirectTo` を使用して一つのパスを別のパスに向けます。
|
||
|
||
```ts
|
||
{ path: 'articles', redirectTo: '/blog' },
|
||
{ path: 'blog', component: Blog },
|
||
```
|
||
|
||
## ページタイトル
|
||
|
||
アクセシビリティのためにルートにタイトルを関連付けます。タイトルは静的または動的(`ResolveFn` またはカスタム `TitleStrategy` 経由)にできます。
|
||
|
||
```ts
|
||
{ path: 'home', component: Home, title: 'Home Page' }
|
||
```
|
||
|
||
## ルートデータとプロバイダー
|
||
|
||
- **静的データ**:`data` プロパティを使用してメタデータを付加します。
|
||
- **ルートプロバイダー**:`providers` 配列を使用して特定のルートとその子に依存関係をスコープします。
|
||
|
||
## ネスト(子)ルート
|
||
|
||
`children` プロパティを使用してサブビューを定義します。親コンポーネントには `<router-outlet />` が必要です。
|
||
|
||
```ts
|
||
{
|
||
path: 'product/:id',
|
||
component: Product,
|
||
children: [
|
||
{ path: 'info', component: ProductInfo },
|
||
{ path: 'reviews', component: ProductReviews },
|
||
],
|
||
}
|
||
```
|