Skip to content

Commit 7778761

Browse files
authored
chore: update origin (#925)
1 parent 2c9e581 commit 7778761

File tree

97 files changed

+1738
-390
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

97 files changed

+1738
-390
lines changed

.github/workflows/build-and-test.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
submodules: true
1818
- uses: actions/setup-node@v4
1919
with:
20-
node-version-file: 'package.json'
20+
node-version-file: '.node-version'
2121
cache: yarn
2222
- run: yarn install
2323
- run: yarn test
@@ -29,7 +29,7 @@ jobs:
2929
submodules: true
3030
- uses: actions/setup-node@v4
3131
with:
32-
node-version-file: 'package.json'
32+
node-version-file: '.node-version'
3333
cache: yarn
3434
- run: yarn install
3535
- run: yarn build
@@ -54,7 +54,7 @@ jobs:
5454
submodules: true
5555
- uses: actions/setup-node@v4
5656
with:
57-
node-version-file: 'package.json'
57+
node-version-file: '.node-version'
5858
cache: yarn
5959
- run: yarn install
6060
- run: yarn build

.node-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
v20.13.1

aio-ja/content/errors/NG0602.md

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
@name Disallowed function call inside reactive context
2+
@category runtime
3+
@shortDescription A disallowed function is called inside a reactive context
4+
5+
@description
6+
A function that is not allowed to run inside a reactive context was called from within a reactive context.
7+
8+
For example, an `effect` cannot be scheduled from within a `computed` or an actively executing effect.
9+
Avoid calling functions like `effect` as part of template expressions, as those execute in their own reactive context.
10+
11+
Computed expressions are expected to be pure.
12+
Pure means that expression do not trigger any side effects.
13+
Side effects are operations like scheduling `afterRender`, creating a new `effect`, or subscribing to observables.
14+
15+
Some operations are explicitly banned inside reactive contexts in order to avoid common pitfalls.
16+
As an example, using `afterRender` inside a `computed` will schedule new render hooks every time the computed expression evaluates.
17+
This is likely not intended and could degrade application performance.
18+
19+
### Fixing the error
20+
21+
This error guide is non-exhaustive.
22+
It captures a few common scenarios and how to address the error.
23+
24+
#### `afterRender`
25+
Move the call for `afterRender` outside of the reactive context.
26+
27+
A good place to schedule the after render hook is in the component's class constructor.
28+
Alternatively, use `untracked` to leave the reactive context and explicitly opt-out of this error.
29+
30+
#### `effect`
31+
Move the call for `effect` outside of the reactive context.
32+
33+
A good place to schedule an effect is in a `@Component`'s class constructor.
34+
35+
#### `toSignal`
36+
Move the call for `toSignal` outside of the reactive context.
37+
38+
```typescript
39+
result = computed(() => {
40+
const dataSignal = toSignal(dataObservable$);
41+
return doSomething(dataSignal());
42+
});
43+
```
44+
45+
can be refactored into:
46+
47+
```typescript
48+
dataSignal = toSignal(dataObservable$);
49+
result = computed(() => doSomething(dataSignal()));
50+
```
51+
52+
Alternatively, if this is not possible, consider manually subscribing to the observable.
53+
54+
As a last resort, use `untracked` to leave the reactive context.
55+
Be careful as leaving the reactive context can result in signal reads to be ignored inside `untracked`.
56+
57+
@debugging
58+
59+
The error message mentions the function that was unexpectedly called.
60+
Look for this function call in your application code.
61+
62+
Alternatively, the stack trace in your browser will show where the function was invoked and where it's located.

aio-ja/content/errors/NG0950.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
@name Input is required but no value is available yet.
2+
@category runtime
3+
@shortDescription A required input is accessed before a value is set.
4+
5+
@description
6+
A required input was accessed but no value was bound.
7+
8+
This can happen when a required input is accessed too early in your directive or component.
9+
This is commonly happening when the input is read as part of class construction.
10+
11+
Inputs are guaranteed to be available in the `ngOnInit` lifecycle hook and afterwards.
12+
13+
## Fixing the error
14+
15+
Access the required input in reactive contexts.
16+
For example, in the template itself, inside a `computed`, or inside an effect.
17+
18+
Alternatively, access the input inside the `ngOnInit` lifecycle hook, or later.

aio-ja/content/errors/NG0951.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
@name Child query result is required but no value is available.
2+
@category runtime
3+
@shortDescription Required child query result was accessed before query results were calculated or query has no matches.
4+
5+
@description
6+
Required child query (`contentChild.required` or `viewChild.required`) result was accessed before query results were calculated or query has no matches.
7+
8+
This can happen in two distinct situations:
9+
* query results were accessed before a given query could collect results;
10+
* a query was executed but didn't match any nodes and has no results as a consequence.
11+
12+
Content queries and view queries each calculate their results at different points in time:
13+
* `contentChild` results are available after a _host_ view (template where a directive declaring a query is used) is created;
14+
* `viewChild` results are available after a template of a component declaring a query is created.
15+
16+
Accessing query results before they're available results in the error described on this page. Most notably, query results are _never_ available in a constructor of the component or directive declaring a query.
17+
18+
## Fixing the error
19+
20+
`contentChild` query results can be accessed in the `AfterContentChecked` lifecycle hook, or later.
21+
`viewChild` query results can be accessed in the `AfterViewChecked` lifecycle hook, or later.
22+
23+
Make sure that a required query matches at least one node and has results at all. You can verify this by accessing query results in the lifecycle hooks listed above.

aio-ja/content/guide/angular-package-format.en.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -347,8 +347,8 @@ This is because the tslib version is tied to the TypeScript version used to comp
347347

348348
## Examples
349349

350-
* [@angular/core package](https://unpkg.com/browse/@angular/core@13.0.0-rc.0)
351-
* [@angular/material package](https://unpkg.com/browse/@angular/material@13.0.0-rc.0)
350+
* [@angular/core package](https://unpkg.com/browse/@angular/core@17.0.0/)
351+
* [@angular/material package](https://unpkg.com/browse/@angular/material@17.0.0/)
352352

353353
## Definition of terms
354354

aio-ja/content/guide/angular-package-format.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -347,8 +347,8 @@ APF v10 では、プライマリエントリポイントの直接の依存関係
347347

348348
##
349349

350-
* [@angular/core パッケージ](https://unpkg.com/browse/@angular/core@13.0.0-rc.0)
351-
* [@angular/material パッケージ](https://unpkg.com/browse/@angular/material@13.0.0-rc.0)
350+
* [@angular/core パッケージ](https://unpkg.com/browse/@angular/core@17.0.0/)
351+
* [@angular/material パッケージ](https://unpkg.com/browse/@angular/material@17.0.0/)
352352

353353
## 用語の定義
354354

aio-ja/content/guide/change-detection-zone-pollution.en.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ In the image above, there is a series of change detection calls triggered by eve
2121

2222
## Run tasks outside `NgZone`
2323

24-
In such cases, you can instruct Angular to avoid calling change detection for tasks scheduled by a given piece of code using [NgZone](/guide/zone).
24+
In such cases, you can instruct Angular to avoid calling change detection for tasks scheduled by a given piece of code using [NgZone](/api/core/NgZone).
2525

2626
```ts
2727
import { Component, NgZone, OnInit } from '@angular/core';

aio-ja/content/guide/change-detection-zone-pollution.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Angular DevTools を使用すると、不要な変更検知の呼び出しを見
2121

2222
## NgZone の外でタスクを実行
2323

24-
このような場合、[NgZone](/guide/zone) を使って、特定のコードによってスケジュールされたタスクの変更検知を呼び出さないよう Angular に指示することができます。
24+
このような場合、[NgZone](/api/core/NgZone) を使って、特定のコードによってスケジュールされたタスクの変更検知を呼び出さないよう Angular に指示することができます。
2525

2626
```ts
2727
import { Component, NgZone, OnInit } from '@angular/core';

aio-ja/content/guide/component-overview.en.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,20 @@ To declare the styles within the component, add a `styles` property to the `@Com
142142

143143
The `styles` property takes an array of strings that contain the CSS rule declarations.
144144

145+
### Creating a component manually
146+
147+
Our recommendation is to make components standalone using the `standalone: true` flag in the `@Component` decorator.
148+
149+
<code-example path="component-overview/src/app/component-overview/component-overview.component.4.ts" region="standalonedeclaration"></code-example>
150+
151+
However, in the case of working with a `NgModule` based application, the component needs to be added to the proper `@NgModule`.
152+
To embed a component in a module, embed it in the array of declarations found in the `@NgModule` decorator.
153+
154+
<code-example path="component-overview/src/app/component-overview/component-overview.module.ts" region="componentmoduledeclaration"></code-example>
155+
156+
With these steps completed, your Angular component is ready for integration and use within your application.
157+
158+
145159
## Next steps
146160

147161
* For an architectural overview of components, see [Introduction to components and templates](guide/architecture-components)

aio-ja/content/guide/component-overview.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,19 @@ Angular コンポーネントは、`template` または `templateUrl` で定義
174174

175175
`styles` プロパティは、CSS ルールの宣言を含む文字列の配列を取ります。
176176

177+
### 手動でコンポーネントを作成する
178+
179+
お勧めは、`@Component` デコレーターの `standalone: true` フラグを使ってコンポーネントをスタンドアロンにすることです。
180+
181+
<code-example path="component-overview/src/app/component-overview/component-overview.component.4.ts" region="standalonedeclaration"></code-example>
182+
183+
しかし、`NgModule` ベースのアプリケーションを扱う場合は、コンポーネントを適切な `@NgModule` に追加する必要があります。
184+
コンポーネントをモジュールに組み込むには、`@NgModule` デコレーターの宣言配列にコンポーネントを追加します。
185+
186+
<code-example path="component-overview/src/app/component-overview/component-overview.module.ts" region="componentmoduledeclaration"></code-example>
187+
188+
これらの手順が完了すれば、Angularコンポーネントをアプリケーションに統合して使用する準備が整います。
189+
177190

178191
## 次のステップ {@a next-steps}
179192

aio-ja/content/guide/defer.md

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ Note: Multiple `on` triggers are always OR conditions. Similarly, `on` mixed wit
100100
```
101101

102102
<a id="when"></a>
103-
`when` specifies an imperative condition as an expression that returns a boolean. When this expression becomes truthy, the placeholder is swapped with the lazily loaded content (which may be an asynchronous operation if the dependencies need to be fetched).
103+
`when` specifies a condition as an expression that returns a boolean. When this expression becomes truthy, the placeholder is swapped with the lazily loaded content (which may be an asynchronous operation if the dependencies need to be fetched).
104104

105105
Note: if the `when` condition switches back to `false`, the defer block is not reverted back to the placeholder. The swap is a one-time operation. If the content within the block should be conditionally rendered, an `if` condition can be used within the block itself.
106106

@@ -240,15 +240,20 @@ In the example below, the prefetching starts when a browser becomes idle and the
240240

241241
## Testing
242242

243-
Angular provides TestBed APIs to simplify the process of testing `@defer` blocks and triggering different states during testing. By default, `@defer` blocks in tests are "paused", so that you can manually transition between states.
243+
Angular provides TestBed APIs to simplify the process of testing `@defer` blocks and triggering different states during testing. By default, `@defer` blocks in tests will play through like a defer block would behave in a real application. If you want to manually step through states, you can switch the defer block behavior to `Manual` in the TestBed configuration.
244244

245245
```typescript
246246
it('should render a defer block in different states', async () => {
247+
// configures the defer block behavior to start in "paused" state for manual control.
248+
TestBed.configureTestingModule({deferBlockBehavior: DeferBlockBehavior.Manual});
249+
247250
@Component({
248251
// ...
249252
template: `
250253
@defer {
251254
<large-component />
255+
} @placeholder {
256+
Placeholder
252257
} @loading {
253258
Loading...
254259
}
@@ -260,15 +265,18 @@ it('should render a defer block in different states', async () => {
260265
const componentFixture = TestBed.createComponent(ComponentA);
261266

262267
// Retrieve the list of all defer block fixtures and get the first block.
263-
const deferBlockFixture = componentFixture.getDeferBlocks()[0];
268+
const deferBlockFixture = (await componentFixture.getDeferBlocks())[0];
269+
270+
// Renders placeholder state by default.
271+
expect(componentFixture.nativeElement.innerHTML).toContain('Placeholder');
264272

265273
// Render loading state and verify rendered output.
266274
await deferBlockFixture.render(DeferBlockState.Loading);
267275
expect(componentFixture.nativeElement.innerHTML).toContain('Loading');
268276

269277
// Render final state and verify the output.
270-
await deferBlockFixture.render(DeferBlockState.Completed);
271-
expect(componentFixture.nativeElement.innerHTML).toContain('<large-component>');
278+
await deferBlockFixture.render(DeferBlockState.Complete);
279+
expect(componentFixture.nativeElement.innerHTML).toContain('large works!');
272280
});
273281
```
274282

aio-ja/content/guide/deployment.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,6 @@ You can read more by following the links associated with the package names below
8787
| [Vercel](https://vercel.com/solutions/angular) | [`vercel init angular`](https://github.com/vercel/vercel/tree/main/examples/angular) |
8888
| [Netlify](https://www.netlify.com) | [`@netlify-builder/deploy`](https://npmjs.org/package/@netlify-builder/deploy) |
8989
| [GitHub pages](https://pages.github.com) | [`angular-cli-ghpages`](https://npmjs.org/package/angular-cli-ghpages) |
90-
| [NPM](https://npmjs.com) | [`ngx-deploy-npm`](https://npmjs.org/package/ngx-deploy-npm) |
9190
| [Amazon Cloud S3](https://aws.amazon.com/s3/?nc2=h_ql_prod_st_s3) | [`@jefiozie/ngx-aws-deploy`](https://www.npmjs.com/package/@jefiozie/ngx-aws-deploy) |
9291

9392
If you're deploying to a self-managed server or there's no builder for your favorite cloud platform, you can either create a builder that allows you to use the `ng deploy` command, or read through this guide to learn how to manually deploy your application.

aio-ja/content/guide/deprecations.md

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ comprehensive details on deprecations and breaking changes.
1313
<div class="alert is-helpful">
1414

1515
Features and APIs that were deprecated in v6 or earlier are candidates for removal in version 9 or any later major version.
16-
For information about Angular's deprecation and removal practices, see [Angular Release Practices](guide/releases#deprecation-practices "Angular Release Practices: Deprecation practices").
16+
For information about Angular's deprecation and removal practices, see [Angular Release Practices](guide/releases#deprecation-policy "Angular Release Practices: Deprecation policy").
1717

1818
For step-by-step instructions on how to update to the latest Angular release, use the interactive update guide at [update.angular.io](https://update.angular.io).
1919

@@ -372,7 +372,12 @@ be converted to functions by instead using `inject` to get dependencies.
372372

373373
For testing a function `canActivate` guard, using `TestBed` and `TestBed.runInInjectionContext` is recommended.
374374
Test mocks and stubs can be provided through DI with `{provide: X, useValue: StubX}`.
375-
Functional guards can also be written in a way that's either testable with
375+
376+
You can also continue to use your class-based guards and pass in the mock dependencies.
377+
When used in the route definition, you can map these guards to functions using the helper
378+
functions in the router package `mapToCanMatch`, `mapToCanActivate`, etc.
379+
380+
Finally, functional guards can be written in a way that's either testable with
376381
`runInInjectionContext` or by passing mock implementations of dependencies.
377382
For example:
378383

@@ -385,7 +390,7 @@ export function myGuardWithMockableDeps(
385390
386391
const route = {
387392
path: 'admin',
388-
canActivate: [myGuardWithMockableDeps]
393+
canActivate: [() => myGuardWithMockableDeps()]
389394
}
390395
```
391396

aio-ja/content/guide/devtools.en.md

Lines changed: 45 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,17 @@ After you select a particular component, click the icon at the top-right of the
105105

106106
</div>
107107

108+
### View injected services of components
109+
Starting in Angular 17, services that are injected in a component or directive context are viewable in the property viewer. After you select a particular component, if that component has dependencies, you'll be able to see them listed under the *"Injected Services"* bar.
110+
111+
By clicking on a service, an expansion panel will appear that visualizes the resolution path that Angular used to resolve that service.
112+
113+
<div class="lightbox">
114+
115+
<img alt="A screenshot of Angular DevTools components tab showing injected services for a selected component." src="generated/images/guide/devtools/di-component-deps.png">
116+
117+
</div>
118+
108119
### Update property value
109120

110121
Like browsers' DevTools, the properties view lets you edit the value of an input, output, or another property.
@@ -242,10 +253,43 @@ Then, import the file in the initial view of the profiler by clicking the **Choo
242253

243254
</div>
244255

256+
## Inspect your injectors
257+
258+
*Note: The Injector Tree is available for Angular Applications built with version 17 or higher.*
259+
260+
### View the injector hierarchy of your application
261+
262+
The **Injector Tree** tab lets you explore the structure of the Injectors configured in your application. Here you will see two trees representing the [injector hiearchy](guide/hierarchical-dependency-injection) of your application. One tree is your environment hierarchy, the other is your element hierachy.
263+
264+
<div class="lightbox">
265+
266+
<img alt="A screenshot showing the injector tree tab in Angular Devtools visualizing the injector graph for an example application." src="generated/images/guide/devtools/di-injector-tree.png">
267+
268+
</div>
269+
270+
### Visualize resolution paths
271+
272+
When a specific injector is selected, the path that Angular's depenedency injection algorithm traverses from that injector to the root is highlighted. For element injectors, this includes highlighting the environment injectors that the dependency injection algorithm jumps to when a dependency cannot be resolved in the element hierarchy. See [resolution rules](guide/hierarchical-dependency-injection#resolution-rules) for more details about how Angular resolves resolution paths.
273+
274+
<div class="lightbox">
275+
276+
<img alt="A screenshot showing how the injector tree visualize highlights resolution paths when an injector is selected." src="generated/images/guide/devtools/di-injector-tree-selected.png">
277+
278+
</div>
279+
280+
### View injector providers
281+
282+
Clicking an injector that has configured providers will display those providers in a list on the right of the injector tree view. Here you can view the provided token and it's type.
283+
284+
<div class="lightbox">
285+
286+
<img alt="A screenshot showing how providers are made visible when an injector is selected." src="generated/images/guide/devtools/di-injector-tree-providers.png">
287+
288+
</div>
245289
<!-- links -->
246290

247291
<!-- external links -->
248292

249293
<!-- end links -->
250294

251-
@reviewed 2022-02-28
295+
@reviewed 2023-11-08

0 commit comments

Comments
 (0)