Skip to content

Commit 93dd803

Browse files
committed
fix: migrate changes
1 parent 77e2c13 commit 93dd803

34 files changed

+182
-196
lines changed

adev-ja/src/content/guide/elements.en.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@ Component properties and logic maps directly into HTML attributes and the browse
6464
For example, for a component with `inputProp = input({alias: 'myInputProp'})`, the corresponding custom element defines an attribute `my-input-prop`.
6565

6666
* Component outputs are dispatched as HTML [Custom Events](https://developer.mozilla.org/docs/Web/API/CustomEvent), with the name of the custom event matching the output name.
67-
For example, for a component with valueChanged = output()`, the corresponding custom element dispatches events with the name "valueChanged", and the emitted data is stored on the event's `detail` property.
68-
If you provide an alias, that value is used; for example, clicks = output<string>({alias: 'myClick'});` results in dispatch events with the name "myClick".
67+
For example, for a component `with valueChanged = output()`, the corresponding custom element dispatches events with the name "valueChanged", and the emitted data is stored on the event's `detail` property.
68+
If you provide an alias, that value is used; for example, `clicks = output<string>({alias: 'myClick'});` results in dispatch events with the name "myClick".
6969

7070
For more information, see Web Component documentation for [Creating custom events](https://developer.mozilla.org/docs/Web/Guide/Events/Creating_and_triggering_events#Creating_custom_events).
7171

adev-ja/src/content/guide/http/making-requests.en.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,9 @@ export class UserProfileComponent {
262262
private userService = inject(UserService);
263263

264264
constructor(): void {
265-
this.user$ = this.userService.getUser(this.userId());
265+
effect(() => {
266+
this.user$ = this.userService.getUser(this.userId());
267+
});
266268
}
267269
}
268270
</docs-code>

adev-ja/src/content/guide/http/making-requests.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,9 @@ export class UserProfileComponent {
262262
private userService = inject(UserService);
263263

264264
constructor(): void {
265-
this.user$ = this.userService.getUser(this.userId());
265+
effect(() => {
266+
this.user$ = this.userService.getUser(this.userId());
267+
});
266268
}
267269
}
268270
</docs-code>

adev-ja/src/content/guide/http/testing.en.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ At the end, tests can verify that the app made no unexpected requests.
1010

1111
To begin testing usage of `HttpClient`, configure `TestBed` and include `provideHttpClient()` and `provideHttpClientTesting()` in your test's setup. This configures `HttpClient` to use a test backend instead of the real network. It also provides `HttpTestingController`, which you'll use to interact with the test backend, set expectations about which requests have been made, and flush responses to those requests. `HttpTestingController` can be injected from `TestBed` once configured.
1212

13-
Keep in mind to provide `provideHttpClient()` **before** `provideHttpClientTesting()`, as `provideHttpClientTesting()` will overwrite parts of `provideHttpCient()`. Doing it the other way around can potentially break your tests.
13+
Keep in mind to provide `provideHttpClient()` **before** `provideHttpClientTesting()`, as `provideHttpClientTesting()` will overwrite parts of `provideHttpClient()`. Doing it the other way around can potentially break your tests.
1414

1515
<docs-code language="ts">
1616
TestBed.configureTestingModule({

adev-ja/src/content/guide/http/testing.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
`HttpClient` の使用のテストを開始するには、`TestBed` を構成してテストの設定に `provideHttpClient()``provideHttpClientTesting()` を含めます。これにより、`HttpClient` が実際のネットワークではなくテストバックエンドを使用するように構成されます。また、`HttpTestingController` も提供され、これを使用してテストバックエンドとやり取ります。そして、どのリクエストが行われたかについての期待を設定し、それらのリクエストに対するレスポンスを流します。`HttpTestingController` は、構成されたら `TestBed` から注入できます。
1212

13-
`provideHttpClientTesting()``provideHttpCient()` の一部を上書きするため、`provideHttpClient()``provideHttpClientTesting()`****に提供することに留意してください。これを逆に行うと、テストが壊れてしまう可能性があります。
13+
`provideHttpClientTesting()``provideHttpClient()` の一部を上書きするため、`provideHttpClient()``provideHttpClientTesting()`****に提供することに留意してください。これを逆に行うと、テストが壊れてしまう可能性があります。
1414

1515
<docs-code language="ts">
1616
TestBed.configureTestingModule({

adev-ja/src/content/guide/hydration.en.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ Application stability is an important part of the hydration process. Hydration a
177177

178178
## I18N
179179

180-
HELPFUL: Support for internationalization with hydration is currently in [developer preview](/reference/releases#developer-preview). By default, Angular will skip hydration for components that use i18n blocks, effectively re-rendering those components from scratch.
180+
HELPFUL: By default, Angular will skip hydration for components that use i18n blocks, effectively re-rendering those components from scratch.
181181

182182
To enable hydration for i18n blocks, you can add [`withI18nSupport`](/api/platform-browser/withI18nSupport) to your `provideClientHydration` call.
183183

@@ -203,7 +203,7 @@ There are a number of third party libraries that depend on DOM manipulation to b
203203

204204
## Third Party Scripts with DOM Manipulation
205205

206-
Many third party scripts, such as ad trackers and analytics, modify the DOM before hydration can occur. These scripts may cause hydration errors because the page no longer matches the structure expected by Angular. Prefer deferring this type of script until after hydration whenever possible. Consider using [`AfterNextRender`](api/core/afterNextRender) to delay the script until post-hydration processes have occured.
206+
Many third party scripts, such as ad trackers and analytics, modify the DOM before hydration can occur. These scripts may cause hydration errors because the page no longer matches the structure expected by Angular. Prefer deferring this type of script until after hydration whenever possible. Consider using [`AfterNextRender`](api/core/afterNextRender) to delay the script until post-hydration processes have occurred.
207207

208208
## Incremental Hydration
209209

adev-ja/src/content/guide/hydration.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ HELPFUL: これによりレンダリングの問題は修正されますが、
177177

178178
## I18N {#i18n}
179179

180-
HELPFUL: ハイドレーションによる国際化のサポートは、現在 [開発者プレビュー](/reference/releases#developer-preview) 段階です。デフォルトでは、Angularはi18nブロックを使用するコンポーネントのハイドレーションをスキップし、それらのコンポーネントを最初から再レンダリングします。
180+
HELPFUL: デフォルトでは、Angularはi18nブロックを使用するコンポーネントのハイドレーションをスキップし、それらのコンポーネントを最初から再レンダリングします。
181181

182182
i18nブロックのハイドレーションを有効にするには、`provideClientHydration` の呼び出しに [`withI18nSupport`](/api/platform-browser/withI18nSupport) を追加します。
183183

@@ -203,7 +203,7 @@ bootstrapApplication(AppComponent, {
203203

204204
## DOM操作を伴うサードパーティスクリプト {#third-party-scripts-with-dom-manipulation}
205205

206-
広告トラッカーやアナリティクスなど、多くのサードパーティスクリプトは、ハイドレーションが行われる前にDOMを変更します。これらのスクリプトは、ページがAngularが期待する構造と一致しなくなるため、ハイドレーションエラーを引き起こす可能性があります。可能な限り、この種のスクリプトをハイドレーション後まで遅らせることを推奨します。`AfterNextRender` を使用して、ハイドレーション後のプロセスが発生するまでスクリプトを遅延させることを検討してください
206+
広告トラッカーやアナリティクスなど、多くのサードパーティスクリプトは、ハイドレーションが行われる前にDOMを変更します。これらのスクリプトは、ページがAngularが期待する構造と一致しなくなるため、ハイドレーションエラーを引き起こす可能性があります。可能な限り、この種のスクリプトをハイドレーション後まで遅らせることを推奨します。[`AfterNextRender`](api/core/afterNextRender) を使用して、ハイドレーション後のプロセスが完了するまでスクリプトを遅延させることを検討してください
207207

208208
## インクリメンタルハイドレーション {#incremental-hydration}
209209

adev-ja/src/content/guide/routing/common-router-tasks.en.md

Lines changed: 23 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ To edit an item, users click an Edit button, which opens an `EditGroceryItem` co
1111
You want that component to retrieve the `id` for the grocery item so it can display the right information to the user.
1212

1313
Use a route to pass this type of information to your application components.
14-
To do so, you use the [withComponentInputBinding](api/router/withComponentInputBinding) feature with `provideRouter` or the `bindToComponentInputs` option of `RouterModule.forRoot`.
14+
To do so, you use the [`withComponentInputBinding`](api/router/withComponentInputBinding) feature with `provideRouter` or the `bindToComponentInputs` option of `RouterModule.forRoot`.
1515

1616
To get information from a route:
1717

@@ -29,23 +29,39 @@ providers: [
2929

3030
</docs-step>
3131

32-
<docs-step title="Add an `Input` to the component">
32+
<docs-step title="Add an `input` to the component">
3333

3434
Update the component to have an `input()` property matching the name of the parameter.
3535

3636
```ts
3737
id = input.required<string>()
38-
hero = computed(() => this.service.getHero(heroId));
38+
hero = computed(() => this.service.getHero(id));
3939
```
4040

41-
NOTE: You can bind all route data with key, value pairs to component inputs: static or resolved route data, path parameters, matrix parameters, and query parameters.
42-
If you want to use the parent components route info you will need to set the router `paramsInheritanceStrategy` option:
43-
`withRouterConfig({paramsInheritanceStrategy: 'always'})`
44-
4541
</docs-step>
42+
<docs-step title="Optional: Use a default value">
43+
The router assigns values to all inputs based on the current route when `withComponentInputBinding` is enabled.
44+
The router assigns `undefined` if no route data matches the input key, such as when an optional query parameter is missing.
45+
You should include `undefined` in the `input`'s type when there's a possibility that an input might not be matched by the route.
46+
47+
Provide a default value by either using the `transform` option on the input or managing a local state with a `linkedSignal`.
48+
49+
```ts
50+
id = input.required({
51+
transform: (maybeUndefined: string | undefined) => maybeUndefined ?? '0',
52+
});
53+
// or
54+
id = input<string|undefined>();
55+
internalId = linkedSignal(() => this.id() ?? getDefaultId());
56+
```
4657

58+
</docs-step>
4759
</docs-workflow>
4860

61+
NOTE: You can bind all route data with key, value pairs to component inputs: static or resolved route data, path parameters, matrix parameters, and query parameters.
62+
If you want to use the parent components route info you will need to set the router `paramsInheritanceStrategy` option:
63+
`withRouterConfig({paramsInheritanceStrategy: 'always'})`
64+
4965
## Displaying a 404 page
5066

5167
To display a 404 page, set up a [wildcard route](guide/routing/common-router-tasks#setting-up-wildcard-routes) with the `component` property set to the component you'd like to use for your 404 page as follows:
@@ -61,51 +77,6 @@ const routes: Routes = [
6177
The last route with the `path` of `**` is a wildcard route.
6278
The router selects this route if the requested URL doesn't match any of the paths earlier in the list and sends the user to the `PageNotFoundComponent`.
6379

64-
## Preventing unauthorized access
65-
66-
Use route guards to prevent users from navigating to parts of an application without authorization.
67-
The following route guards are available in Angular:
68-
69-
<docs-pill-row>
70-
<docs-pill href="api/router/CanActivateFn" title="`canActivate`"/>
71-
<docs-pill href="api/router/CanActivateChildFn" title="`canActivateChild`"/>
72-
<docs-pill href="api/router/CanDeactivateFn" title="`canDeactivate`"/>
73-
<docs-pill href="api/router/CanMatchFn" title="`canMatch`"/>
74-
<docs-pill href="api/router/ResolveFn" title="`resolve`"/>
75-
<docs-pill href="api/router/CanLoadFn" title="`canLoad`"/>
76-
</docs-pill-row>
77-
78-
To use route guards, consider using [component-less routes](api/router/Route#componentless-routes) as this facilitates guarding child routes.
79-
80-
Create a file for your guard:
81-
82-
```bash
83-
ng generate guard your-guard
84-
```
85-
86-
In your guard file, add the guard functions you want to use.
87-
The following example uses `canActivateFn` to guard the route.
88-
89-
```ts
90-
export const yourGuardFunction: CanActivateFn = (
91-
next: ActivatedRouteSnapshot,
92-
state: RouterStateSnapshot
93-
) => {
94-
// your logic goes here
95-
}
96-
```
97-
98-
In your routing module, use the appropriate property in your `routes` configuration.
99-
Here, `canActivate` tells the router to mediate navigation to this particular route.
100-
101-
```ts
102-
{
103-
path: '/your-path',
104-
component: YourComponent,
105-
canActivate: [yourGuardFunction],
106-
}
107-
```
108-
10980
## Link parameters array
11081

11182
A link parameters array holds the following ingredients for router navigation:

adev-ja/src/content/guide/routing/common-router-tasks.md

Lines changed: 23 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
そのコンポーネントは、食料品アイテムの `id` を取得して、ユーザーに正しい情報を表示できるようにする必要があります。
1212

1313
ルートを使用して、このタイプの情報をアプリケーションコンポーネントに渡します。
14-
これを行うには、`provideRouter` を使用した [withComponentInputBinding](api/router/withComponentInputBinding) 機能、または `RouterModule.forRoot``bindToComponentInputs` オプションを使用します。
14+
これを行うには、`provideRouter` を使用した [`withComponentInputBinding`](api/router/withComponentInputBinding) 機能、または `RouterModule.forRoot``bindToComponentInputs` オプションを使用します。
1515

1616
ルートから情報を取得するには:
1717

@@ -29,23 +29,39 @@ providers: [
2929

3030
</docs-step>
3131

32-
<docs-step title="コンポーネントに `Input` を追加する">
32+
<docs-step title="コンポーネントに `input` を追加する">
3333

3434
パラメータ名と一致する `input()` プロパティを持つようにコンポーネントを更新します。
3535

3636
```ts
3737
id = input.required<string>()
38-
hero = computed(() => this.service.getHero(heroId));
38+
hero = computed(() => this.service.getHero(id));
3939
```
4040

41-
NOTE: 静的なルートデータ、解決されたルートデータ、パスパラメータ、マトリックスパラメータ、クエリパラメータなど、すべてのルートデータをキーと値のペアでコンポーネントの入力にバインドできます。
42-
親コンポーネントのルート情報を使用する場合は、ルーターの `paramsInheritanceStrategy` オプションを設定する必要があります。
43-
`withRouterConfig({paramsInheritanceStrategy: 'always'})`
44-
4541
</docs-step>
42+
<docs-step title="Optional: Use a default value">
43+
`withComponentInputBinding` が有効な場合、ルーターは現在のルートに基づいてすべての入力に値を割り当てます。
44+
オプションのクエリパラメータが欠落している場合など、ルートデータが入力キーと一致しない場合、ルーターは `undefined` を割り当てます。
45+
入力がルートによって一致しない可能性がある場合は、`input` の型に `undefined` を含める必要があります。
46+
47+
`input``transform` オプションを使用するか、`linkedSignal` でローカル状態を管理することで、デフォルト値を提供します。
48+
49+
```ts
50+
id = input.required({
51+
transform: (maybeUndefined: string | undefined) => maybeUndefined ?? '0',
52+
});
53+
// or
54+
id = input<string|undefined>();
55+
internalId = linkedSignal(() => this.id() ?? getDefaultId());
56+
```
4657

58+
</docs-step>
4759
</docs-workflow>
4860

61+
NOTE: 静的なルートデータ、解決されたルートデータ、パスパラメータ、マトリックスパラメータ、クエリパラメータなど、すべてのルートデータをキーと値のペアでコンポーネントの入力にバインドできます。
62+
親コンポーネントのルート情報を使用する場合は、ルーターの `paramsInheritanceStrategy` オプションを設定する必要があります。
63+
`withRouterConfig({paramsInheritanceStrategy: 'always'})`
64+
4965
## 404 ページの表示 {#displaying-a-404-page}
5066

5167
404ページを表示するには、[ワイルドカードルート](guide/routing/common-router-tasks#setting-up-wildcard-routes) を設定します。このルートの `component` プロパティは、404ページに使用したいコンポーネントに設定します。
@@ -61,51 +77,6 @@ const routes: Routes = [
6177
`path``**` の最後のルートは、ワイルドカードルートです。
6278
ルーターは、要求されたURLがリストの先頭にあるパスと一致しない場合、このルートを選択し、ユーザーを `PageNotFoundComponent` にルーティングします。
6379

64-
## 権限のないアクセスの防止 {#preventing-unauthorized-access}
65-
66-
ルートガードを使用して、ユーザーが権限なしでアプリケーションの特定の部分にナビゲートできないようにします。
67-
Angularでは、次のルートガードを使用できます。
68-
69-
<docs-pill-row>
70-
<docs-pill href="api/router/CanActivateFn" title="`canActivate`"/>
71-
<docs-pill href="api/router/CanActivateChildFn" title="`canActivateChild`"/>
72-
<docs-pill href="api/router/CanDeactivateFn" title="`canDeactivate`"/>
73-
<docs-pill href="api/router/CanMatchFn" title="`canMatch`"/>
74-
<docs-pill href="api/router/ResolveFn" title="`resolve`"/>
75-
<docs-pill href="api/router/CanLoadFn" title="`canLoad`"/>
76-
</docs-pill-row>
77-
78-
ルートガードを使用するには、[コンポーネントレスルート](api/router/Route#componentless-routes) を使用することを検討してください。これにより、子ルートのガードが容易になります。
79-
80-
ガードのファイルを作成します。
81-
82-
```bash
83-
ng generate guard your-guard
84-
```
85-
86-
ガードファイルに、使用するガード関数を追加します。
87-
次の例では、`canActivateFn` を使用してルートをガードしています。
88-
89-
```ts
90-
export const yourGuardFunction: CanActivateFn = (
91-
next: ActivatedRouteSnapshot,
92-
state: RouterStateSnapshot
93-
) => {
94-
// your logic goes here
95-
}
96-
```
97-
98-
ルーティングモジュールで、`routes` 構成の適切なプロパティを使用します。
99-
ここでは、`canActivate` は、ルーターに、この特定のルートへのナビゲーションを制御するよう指示します。
100-
101-
```ts
102-
{
103-
path: '/your-path',
104-
component: YourComponent,
105-
canActivate: [yourGuardFunction],
106-
}
107-
```
108-
10980
## リンクパラメータ配列 {#link-parameters-array}
11081

11182
リンクパラメータ配列には、ルーターナビゲーションの次の要素が含まれています。

0 commit comments

Comments
 (0)