Skip to content

Commit ad39ff0

Browse files
committed
fix: migrate guide/components markdown files
1 parent b032dcc commit ad39ff0

File tree

10 files changed

+88
-84
lines changed

10 files changed

+88
-84
lines changed

adev-ja/src/content/guide/components/anatomy-of-components.en.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,41 +11,41 @@ Every component must have:
1111

1212
You provide Angular-specific information for a component by adding a `@Component` [decorator](https://www.typescriptlang.org/docs/handbook/decorators.html) on top of the TypeScript class:
1313

14-
<docs-code language="angular-ts" highlight="[1, 2, 3, 4]">
14+
```angular-ts {highlight: [1, 2, 3, 4]}
1515
@Component({
1616
selector: 'profile-photo',
1717
template: `<img src="profile-photo.jpg" alt="Your profile photo">`,
1818
})
1919
export class ProfilePhoto { }
20-
</docs-code>
20+
```
2121

2222
For full details on writing Angular templates, including data binding, event handling, and control flow, see the [Templates guide](guide/templates).
2323

2424
The object passed to the `@Component` decorator is called the component's **metadata**. This includes the `selector`, `template`, and other properties described throughout this guide.
2525

2626
Components can optionally include a list of CSS styles that apply to that component's DOM:
2727

28-
<docs-code language="angular-ts" highlight="[4]">
28+
```angular-ts {highlight: [4]}
2929
@Component({
3030
selector: 'profile-photo',
3131
template: `<img src="profile-photo.jpg" alt="Your profile photo">`,
3232
styles: `img { border-radius: 50%; }`,
3333
})
3434
export class ProfilePhoto { }
35-
</docs-code>
35+
```
3636

3737
By default, a component's styles only affect elements defined in that component's template. See [Styling Components](guide/components/styling) for details on Angular's approach to styling.
3838

3939
You can alternatively choose to write your template and styles in separate files:
4040

41-
<docs-code language="angular-ts" highlight="[3, 4]">
41+
```ts {highlight: [3,4]}
4242
@Component({
4343
selector: 'profile-photo',
4444
templateUrl: 'profile-photo.html',
4545
styleUrl: 'profile-photo.css',
4646
})
4747
export class ProfilePhoto { }
48-
</docs-code>
48+
```
4949

5050
This can help separate the concerns of _presentation_ from _behavior_ in your project. You can choose one approach for your entire project, or you decide which to use for each component.
5151

@@ -78,19 +78,19 @@ Important: In Angular versions before 19.0.0, the `standalone` option defaults t
7878

7979
Every component defines a [CSS selector](https://developer.mozilla.org/docs/Learn/CSS/Building_blocks/Selectors):
8080

81-
<docs-code language="angular-ts" highlight="[2]">
81+
```angular-ts {highlight: [2]}
8282
@Component({
8383
selector: 'profile-photo',
8484
...
8585
})
8686
export class ProfilePhoto { }
87-
</docs-code>
87+
```
8888

8989
See [Component Selectors](guide/components/selectors) for details about which types of selectors Angular supports and guidance on choosing a selector.
9090

9191
You show a component by creating a matching HTML element in the template of _other_ components:
9292

93-
<docs-code language="angular-ts" highlight="[8]">
93+
```angular-ts {highlight: [8]}
9494
@Component({
9595
selector: 'profile-photo',
9696
})
@@ -101,7 +101,7 @@ imports: [ProfilePhoto],
101101
template: `<profile-photo />`
102102
})
103103
export class UserProfile { }
104-
</docs-code>
104+
```
105105

106106
Angular creates an instance of the component for every matching HTML element it encounters. The DOM element that matches a component's selector is referred to as that component's **host element**. The contents of a component's template are rendered inside its host element.
107107

adev-ja/src/content/guide/components/anatomy-of-components.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,41 +11,41 @@ TIP: このガイドでは、すでに[基本ガイド](essentials)を読んで
1111

1212
TypeScriptクラスの上部に `@Component` [デコレーター](https://www.typescriptlang.org/docs/handbook/decorators.html) を追加することで、コンポーネントにAngular固有の情報を与えます。
1313

14-
<docs-code language="angular-ts" highlight="[1, 2, 3, 4]">
14+
```angular-ts {highlight: [1, 2, 3, 4]}
1515
@Component({
1616
selector: 'profile-photo',
1717
template: `<img src="profile-photo.jpg" alt="Your profile photo">`,
1818
})
1919
export class ProfilePhoto { }
20-
</docs-code>
20+
```
2121

2222
データバインディング、イベント処理、制御フローなど、Angularテンプレート作成に関する詳細は、[テンプレートガイド](guide/templates)を参照してください。
2323

2424
`@Component` デコレーターに渡されるオブジェクトは、コンポーネントの**メタデータ**と呼ばれます。これには、このガイドで説明されている `selector``template`、その他のプロパティが含まれています。
2525

2626
コンポーネントには、オプションでそのコンポーネントのDOMに適用されるCSSスタイルのリストを含めることができます。
2727

28-
<docs-code language="angular-ts" highlight="[4]">
28+
```angular-ts {highlight: [4]}
2929
@Component({
3030
selector: 'profile-photo',
3131
template: `<img src="profile-photo.jpg" alt="Your profile photo">`,
3232
styles: `img { border-radius: 50%; }`,
3333
})
3434
export class ProfilePhoto { }
35-
</docs-code>
35+
```
3636

3737
デフォルトでは、コンポーネントのスタイルは、そのコンポーネントのテンプレートで定義された要素にのみ影響を与えます。Angularのスタイリングアプローチの詳細については、[コンポーネントのスタイリング](guide/components/styling)を参照してください。
3838

3939
テンプレートとスタイルを別々のファイルにも記述できます。
4040

41-
<docs-code language="angular-ts" highlight="[3, 4]">
41+
```ts {highlight: [3,4]}
4242
@Component({
4343
selector: 'profile-photo',
4444
templateUrl: 'profile-photo.html',
4545
styleUrl: 'profile-photo.css',
4646
})
4747
export class ProfilePhoto { }
48-
</docs-code>
48+
```
4949

5050
これにより、プロジェクト内の_表示_と_動作_の懸念事項を分離できます。プロジェクト全体に対して1つのアプローチを選択するか、コンポーネントごとにどちらを使用するかを決定できます。
5151

@@ -78,19 +78,19 @@ IMPORTANT: 19.0.0より前のAngularバージョンでは、`standalone`オプ
7878

7979
すべてのコンポーネントは[CSSセレクター](https://developer.mozilla.org/docs/Learn/CSS/Building_blocks/Selectors)を定義します。
8080

81-
<docs-code language="angular-ts" highlight="[2]">
81+
```angular-ts {highlight: [2]}
8282
@Component({
8383
selector: 'profile-photo',
8484
...
8585
})
8686
export class ProfilePhoto { }
87-
</docs-code>
87+
```
8888

8989
Angularがサポートするセレクターの種類と、セレクターの選択に関するガイダンスについては、[コンポーネントセレクター](guide/components/selectors)を参照してください。
9090

9191
_他の_コンポーネントのテンプレートで一致するHTML要素を作成することで、コンポーネントを表示します。
9292

93-
<docs-code language="angular-ts" highlight="[8]">
93+
```angular-ts {highlight: [8]}
9494
@Component({
9595
selector: 'profile-photo',
9696
})
@@ -101,7 +101,7 @@ imports: [ProfilePhoto],
101101
template: `<profile-photo />`
102102
})
103103
export class UserProfile { }
104-
</docs-code>
104+
```
105105

106106
Angularは、遭遇する一致するHTML要素ごとにコンポーネントのインスタンスを作成します。コンポーネントのセレクターと一致するDOM要素は、そのコンポーネントの**ホスト要素**と呼ばれます。コンポーネントのテンプレートの内容はそのホスト要素内にレンダリングされます。
107107

adev-ja/src/content/guide/components/content-projection.en.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ export class CardBody {}
9595

9696
```angular-ts
9797
<!-- Component template -->
98-
Component({
98+
@Component({
9999
selector: 'custom-card',
100100
template: `
101101
<div class="card-shadow">
@@ -218,7 +218,7 @@ placeholder, Angular compares against the `ngProjectAs` value instead of the ele
218218
<div class="card-shadow">
219219
<ng-content select="card-title"></ng-content>
220220
<div class="card-divider"></div>
221-
<ng-content></ng-content>
221+
<ng-content />
222222
</div>
223223
```
224224

adev-ja/src/content/guide/components/content-projection.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ export class CardBody {}
9595

9696
```angular-ts
9797
<!-- コンポーネントテンプレート -->
98-
Component({
98+
@Component({
9999
selector: 'custom-card',
100100
template: `
101101
<div class="card-shadow">
@@ -218,7 +218,7 @@ Angularは要素のIDではなく`ngProjectAs`の値と比較します。
218218
<div class="card-shadow">
219219
<ng-content select="card-title"></ng-content>
220220
<div class="card-divider"></div>
221-
<ng-content></ng-content>
221+
<ng-content />
222222
</div>
223223
```
224224

adev-ja/src/content/guide/components/queries.en.md

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ There are two categories of query: **view queries** and **content queries.**
1515

1616
View queries retrieve results from the elements in the component's _view_ — the elements defined in the component's own template. You can query for a single result with the `viewChild` function.
1717

18-
```typescript {highlight: [14, 15]}
18+
```angular-ts {highlight: [14, 15]}
1919
@Component({
2020
selector: 'custom-card-header',
2121
/*...*/
@@ -40,7 +40,7 @@ If the query does not find a result, its value is `undefined`. This may occur if
4040

4141
You can also query for multiple results with the `viewChildren` function.
4242

43-
```typescript {highlight: [17]}
43+
```angular-ts {highlight: [17]}
4444
@Component({
4545
selector: 'custom-card-action',
4646
/*...*/
@@ -51,13 +51,14 @@ export class CustomCardAction {
5151
5252
@Component({
5353
selector: 'custom-card',
54-
template: `<custom-card-action>Save</custom-card-action>
54+
template: `
55+
<custom-card-action>Save</custom-card-action>
5556
<custom-card-action>Cancel</custom-card-action>
5657
`,
5758
})
5859
export class CustomCard {
5960
actions = viewChildren(CustomCardAction);
60-
actionsTexts = computed(() => this.actions().map(action => action.text);
61+
actionsTexts = computed(() => this.actions().map(action => action.text));
6162
}
6263
```
6364

@@ -69,7 +70,7 @@ export class CustomCard {
6970

7071
Content queries retrieve results from the elements in the component's _content_— the elements nested inside the component in the template where it's used. You can query for a single result with the `contentChild` function.
7172

72-
```typescript {highlight: [14, 15]}
73+
```angular-ts {highlight: [14, 15]}
7374
@Component({
7475
selector: 'custom-toggle',
7576
/*...*/
@@ -106,7 +107,7 @@ By default, content queries find only _direct_ children of the component and do
106107

107108
You can also query for multiple results with the `contentChildren` function.
108109

109-
```typescript {highlight: [14, 16, 17, 18, 19, 20]}
110+
```angular-ts {highlight: [14, 16, 17, 18, 19, 20]}
110111
@Component({
111112
selector: 'custom-menu-item',
112113
/*...*/
@@ -147,7 +148,7 @@ If a child query (`viewChild` or `contentChild`) does not find a result, its val
147148

148149
In some cases, especially with `viewChild`, you know with certainty that a specific child is always available. In other cases, you may want to strictly enforce that a specific child is present. For these cases, you can use a _required query_.
149150

150-
```angular-ts
151+
```ts
151152
@Component({/* ... */})
152153
export class CustomCard {
153154
header = viewChild.required(CustomCardHeader);
@@ -232,7 +233,7 @@ Developers most commonly use `read` to retrieve `ElementRef` and `TemplateRef`.
232233
By default, `contentChildren` queries find only _direct_ children of the component and do not traverse into descendants.
233234
`contentChild` queries do traverse into descendants by default.
234235

235-
```typescript {highlight: [13, 14, 15, 16]}
236+
```angular-ts {highlight: [13, 14, 15, 16]}
236237
@Component({
237238
selector: 'custom-expando',
238239
/*...*/
@@ -244,7 +245,8 @@ export class CustomExpando {
244245
245246
@Component({
246247
selector: 'user-profile',
247-
template: ` <custom-expando>
248+
template: `
249+
<custom-expando>
248250
<some-other-component>
249251
<custom-toggle>Show</custom-toggle>
250252
</some-other-component>
@@ -269,7 +271,7 @@ You can alternatively declare queries by adding the corresponding decorator to a
269271

270272
You can query for a single result with the `@ViewChild` decorator.
271273

272-
```typescript {highlight: [14, 16, 17, 18]}
274+
```angular-ts {highlight: [14, 16, 17, 18]}
273275
@Component({
274276
selector: 'custom-card-header',
275277
/*...*/
@@ -299,7 +301,7 @@ Angular keeps the result of `@ViewChild` up to date as your application state ch
299301

300302
You can also query for multiple results with the `@ViewChildren` decorator.
301303

302-
```typescript {highlight: [17, 19, 20, 21, 22, 23]}
304+
```angular-ts {highlight: [17, 19, 20, 21, 22, 23]}
303305
@Component({
304306
selector: 'custom-card-action',
305307
/*...*/
@@ -332,7 +334,7 @@ export class CustomCard {
332334

333335
You can query for a single result with the `@ContentChild` decorator.
334336

335-
```typescript {highlight: [14, 16, 17, 18, 25]}
337+
```angular-ts {highlight: [14, 16, 17, 18, 25]}
336338
@Component({
337339
selector: 'custom-toggle',
338340
/*...*/
@@ -373,7 +375,7 @@ Angular keeps the result of `@ContentChild` up to date as your application state
373375

374376
You can also query for multiple results with the `@ContentChildren` decorator.
375377

376-
```typescript {highlight: [15, 17, 18, 19, 20, 21]}
378+
```angular-ts {highlight: [15, 17, 18, 19, 20, 21]}
377379
@Component({
378380
selector: 'custom-menu-item',
379381
/*...*/

0 commit comments

Comments
 (0)