Skip to content

Commit

Permalink
fix: normalized
Browse files Browse the repository at this point in the history
  • Loading branch information
asnowwolf committed Dec 10, 2023
1 parent 400fa12 commit 6b3ddd7
Show file tree
Hide file tree
Showing 273 changed files with 6,586 additions and 5,779 deletions.
32 changes: 16 additions & 16 deletions aio/content/blocks/core/defer.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,26 +24,26 @@ A type of [block](api/core/defer) that can be used to defer load the JavaScript

Supported sections of a defer block. Note: only the `@defer` block template fragment is deferred loaded. The remaining optional blocks are eagerly loaded.

| block | Description |
| ----------- | ----------- |
| `@defer` | The defer loaded block of content |
| `@placeholder` | Content shown prior to defer loading (Optional)|
| `@loading` | Content shown during defer loading (Optional) |
| `@error` | Content shown when defer loading errors occur (Optional) |
| block | Description |
| -------------- | -------------------------------------------------------- |
| `@defer` | The defer loaded block of content |
| `@placeholder` | Content shown prior to defer loading (Optional) |
| `@loading` | Content shown during defer loading (Optional) |
| `@error` | Content shown when defer loading errors occur (Optional) |

<h3>Triggers</h3>

Triggers provide conditions for when defer loading occurs. Some allow a template reference variable as an optional parameter. Separate multiple triggers with a semicolon.

| trigger | Triggers... |
| ----------- | ----------- |
| `on idle` | when the browser reports idle state (default) |
| `on viewport(<elementRef>?)` | when the element enters the viewport |
| `on interaction(<elementRef>?)` | when clicked, touched, or focused |
| `on hover(<elementRef>?)` | when element has been hovered |
| `on immediate` | when the page finishes rendering |
| `on timer(<duration>)` | after a specific timeout |
| `when <condition>` | on a custom condition |
| trigger | Triggers... |
| ------------------------------- | --------------------------------------------- |
| `on idle` | when the browser reports idle state (default) |
| `on viewport(<elementRef>?)` | when the element enters the viewport |
| `on interaction(<elementRef>?)` | when clicked, touched, or focused |
| `on hover(<elementRef>?)` | when element has been hovered |
| `on immediate` | when the page finishes rendering |
| `on timer(<duration>)` | after a specific timeout |
| `when <condition>` | on a custom condition |

<h2>Prefetch</h2>

Expand All @@ -55,4 +55,4 @@ Configures prefetching of the defer block used in the `@defer` parameters, but d
}
```

Learn more in the [defer loading guide](guide/defer).
Learn more in the [defer loading guide](guide/defer).
14 changes: 7 additions & 7 deletions aio/content/blocks/core/for.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@ Loops over immutable data without `trackBy` as one of the most common causes for

Inside `@for` contents, several implicit variables are always available:

| Variable | Meaning |
| -------- | ------- |
| Variable | Meaning |
| -------- | --------------------------------------------- |
| `$count` | Number of items in a collection iterated over |
| `$index` | Index of the current row |
| `$first` | Whether the current row is the first row |
| `$last` | Whether the current row is the last row |
| `$even` | Whether the current row index is even |
| `$odd` | Whether the current row index is odd |
| `$index` | Index of the current row |
| `$first` | Whether the current row is the first row |
| `$last` | Whether the current row is the last row |
| `$even` | Whether the current row index is even |
| `$odd` | Whether the current row index is odd |

These variables are always available with these names, but can be aliased via a `let` segment:

Expand Down
28 changes: 14 additions & 14 deletions aio/content/cli/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ You can edit the generated files directly, or add to and modify them using CLI c
Use the [ng generate](cli/generate) command to add new files for additional components and services, and code for new pipes, directives, and so on.
Commands such as [add](cli/add) and [generate](cli/generate), which create or operate on applications and libraries, must be executed from within a workspace or project folder.

* See more about the [Workspace file structure](guide/file-structure).
* See more about the [Workspace file structure](guide/file-structure).

### Workspace and project configuration

Expand All @@ -81,32 +81,32 @@ Option names in the configuration file must use [camelCase](guide/glossary#case-

</div>

* See more about [Workspace Configuration](guide/workspace-config).
* See more about [Workspace Configuration](guide/workspace-config).

## CLI command-language syntax

Command syntax is shown as follows:

`ng` *<command-name>* *<required-arg>* [*optional-arg*] `[options]`

* Most commands, and some options, have aliases.
Aliases are shown in the syntax statement for each command.
* Most commands, and some options, have aliases.
Aliases are shown in the syntax statement for each command.

* Option names are prefixed with a double dash (`--`) characters.
Option aliases are prefixed with a single dash (`-`) character.
Arguments are not prefixed.
For example:
* Option names are prefixed with a double dash (`--`) characters.
Option aliases are prefixed with a single dash (`-`) character.
Arguments are not prefixed.
For example:

<code-example format="shell" language="shell">
<code-example format="shell" language="shell">

ng build my-app -c production
ng build my-app -c production

</code-example>
</code-example>

* Typically, the name of a generated artifact can be given as an argument to the command or specified with the `--name` option.
* Typically, the name of a generated artifact can be given as an argument to the command or specified with the `--name` option.

* Arguments and option names must be given in [dash-case](guide/glossary#case-types).
For example: `--my-option-name`
* Arguments and option names must be given in [dash-case](guide/glossary#case-types).
For example: `--my-option-name`

### Boolean options

Expand Down
3 changes: 3 additions & 0 deletions aio/content/errors/NG0100.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
@name Expression Changed After Checked

@category runtime

@videoUrl https://www.youtube.com/embed/O47uUnJjbJc

@shortDescription Expression has changed after it was checked

@description
Expand Down
4 changes: 4 additions & 0 deletions aio/content/errors/NG01101.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
@name Wrong Async Validator Return Type

@category runtime

@shortDescription Async validator must return a Promise or Observable

@description

Async validators must return a promise or an observable, and emit/resolve them whether the validation fails or succeeds. In particular, they must implement the [AsyncValidatorFn API](api/forms/AsyncValidator)

```typescript
Expand All @@ -19,6 +22,7 @@ export function isTenAsync(control: AbstractControl):
```

@debugging

Did you mistakenly use a synchronous validator instead of an async validator?

<!-- links -->
Expand Down
4 changes: 4 additions & 0 deletions aio/content/errors/NG01203.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
@name Missing value accessor

@category runtime

@shortDescription You must register an `NgValueAccessor` with a custom form control

@description

For all custom form controls, you must register a value accessor.

Here's an example of how to provide one:
Expand All @@ -18,6 +21,7 @@ providers: [
```

@debugging

As described above, your control was expected to have a value accessor, but was missing one. However, there are many different reasons this can happen in practice. Here's a listing of some known problems leading to this error.

1. If you **defined** a custom form control, did you remember to provide a value accessor?
Expand Down
5 changes: 5 additions & 0 deletions aio/content/errors/NG0200.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
@name Circular Dependency in DI

@category runtime

@videoUrl https://www.youtube.com/embed/CpLOm4o_FzM

@shortDescription Circular dependency in DI detected while instantiating a provider

@description

A cyclic dependency exists when a [dependency of a service](guide/hierarchical-dependency-injection) directly or indirectly depends on the service itself. For example, if `UserService` depends on `EmployeeService`, which also depends on `UserService`. Angular will have to instantiate `EmployeeService` to create `UserService`, which depends on `UserService`, itself.

@debugging

Use the call stack to determine where the cyclical dependency exists.
You will be able to see if any child dependencies rely on the original file by [mapping out](guide/dependency-injection-in-action) the component, module, or service's dependencies, and identifying the loop causing the problem.

Expand Down
5 changes: 5 additions & 0 deletions aio/content/errors/NG0201.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
@name No Provider Found

@category runtime

@videoUrl https://www.youtube.com/embed/lAlOryf1-WU

@shortDescription No provider for {token} found!

@description

You see this error when you try to inject a service but have not declared a corresponding provider. A provider is a mapping that supplies a value that you can inject into the constructor of a class in your application.

Read more on providers in our [Dependency Injection guide](guide/dependency-injection).

@debugging

Work backwards from the object where the error states that a [provider](guide/architecture-services) is missing: `No provider for ${this}!`. This is commonly thrown in [services](tutorial/tour-of-heroes/toh-pt4), which require non-existing providers.

To fix the error ensure that your service is registered in the list of providers of an `NgModule` or has the `@Injectable` decorator with a `providedIn` property at top.
Expand Down
3 changes: 3 additions & 0 deletions aio/content/errors/NG0203.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
@name `inject()` must be called from an injection context

@category runtime

@shortDescription `inject()` must be called from an injection context such as a constructor, a factory function, a field initializer, or a function used with `runInInjectionContext`.

@description

You see this error when you try to use the [`inject`](api/core/inject) function outside of the allowed [injection context](guide/dependency-injection-context). The injection context is available during the class creation and initialization. It is also available to functions
used with `runInInjectionContext`.

Expand Down
4 changes: 3 additions & 1 deletion aio/content/errors/NG0209.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
@name Invalid multi provider

@category runtime

@shortDescription Expected provider to be `multi: true` but did not get an Array

@description
Expand All @@ -14,4 +16,4 @@ like `{provide: ENVIRONMENT_INITIALIZER, multi: true, useValue: () => {...}}`.

<!-- end links -->

@reviewed 2022-11-28
@reviewed 2022-11-28
4 changes: 4 additions & 0 deletions aio/content/errors/NG02200.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
@name Missing Iterable Differ

@category runtime

@shortDescription Cannot find a differ for object in ngFor

@description

`NgFor` could not find an iterable differ for the value passed in. Make sure it's an iterable, like an `Array`.

@debugging

When using ngFor in a template, you must use some type of Iterable, like `Array`, `Set`, `Map`, etc.
If you're trying to iterate over the keys in an object, you should look at the [KeyValue pipe](/api/common/KeyValuePipe) instead.

Expand Down
6 changes: 5 additions & 1 deletion aio/content/errors/NG02800.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
@name JSONP support in HttpClient configuration

@category runtime

@shortDescription Missing JSONP support in HttpClient configuration

@description

Angular produces this error when you attempt a `JSONP` request without providing the necessary support for it in the `HttpClient` configuration.
To enable `JSONP` support, you can do one of the following:

- add the `withJsonpSupport()` as an argument during the `provideHttpClient` function call (e.g. `provideHttpClient(withJsonpSupport())`) when `bootstrapApplication` is used
- import the `HttpClientJsonpModule` in your root AppModule, when NgModule-based bootstrap is used.


@debugging

Make sure that the JSONP support is added into your application either by calling the `withJsonpSupport()` function (when the `provideHttpClient()` is used) or importing the `HttpClientJsonpModule` module as described above.

See [Make a JSONP request](/guide/http-make-jsonp-request) for more info.
Expand Down
5 changes: 5 additions & 0 deletions aio/content/errors/NG0300.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
@name Selector Collision

@category runtime

@videoUrl https://www.youtube.com/embed/z_3Z5mOm59I

@shortDescription Multiple components match with the same tagname

@description

Two or more components use the same [element selector](guide/component-overview#specifying-a-components-css-selector). Because there can only be a single component associated with an element, selectors must be unique strings to prevent ambiguity for Angular.

@debugging

Use the element name from the error message to search for places where you're using the same [selector declaration](guide/architecture-components) in your codebase:

<code-example format="typescript" language="typescript">
Expand Down
5 changes: 5 additions & 0 deletions aio/content/errors/NG0301.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
@name Export Not Found

@category runtime

@videoUrl https://www.youtube.com/embed/fUSAg4kp2WQ

@shortDescription Export not found!

@description

Angular can't find a directive with `{{ PLACEHOLDER }}` export name. The export name is specified in the `exportAs` property of the directive decorator. This is common when using FormsModule or Material modules in templates and you've forgotten to [import the corresponding modules](guide/sharing-ngmodules).

<div class="alert is-helpful">
Expand All @@ -13,6 +17,7 @@ This is the runtime equivalent of a common compiler error [NG8003: No directive
</div>

@debugging

Use the export name to trace the templates or modules using this export.

Ensure that all dependencies are [properly imported and declared in your NgModules](guide/sharing-ngmodules). For example, if the export not found is `ngForm`, we need to import `FormsModule` and declare it in the list of imports in `*.module.ts` to resolve the error.
Expand Down
18 changes: 13 additions & 5 deletions aio/content/errors/NG0302.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,33 @@
@name Pipe Not Found

@category runtime

@videoUrl https://www.youtube.com/embed/maI2u6Sxk9M

@videoCaption Note: The video predates standalone pipes, please refer to additional instructions below if you use standalone pipes.

@shortDescription Pipe not found!

@description

Angular can't find a pipe with this name.

The [pipe](guide/pipes-overview) referenced in the template has not been named or declared properly.

To use the pipe:
- Ensure the name used in a template matches the name defined in the pipe decorator.
- Either mark it as standalone by adding the `standalone: true` flag to the pipe's decorator or declare it as a part of an `NgModule` by adding to that module's declarations array.
- Import it in the standalone components and/or the `NgModules` where it is needed.

- Ensure the name used in a template matches the name defined in the pipe decorator.
- Either mark it as standalone by adding the `standalone: true` flag to the pipe's decorator or declare it as a part of an `NgModule` by adding to that module's declarations array.
- Import it in the standalone components and/or the `NgModules` where it is needed.

@debugging

Use the pipe name to trace where the pipe is declared and used.

To resolve this error:
- If the pipe is local to the `NgModule`, give it a unique name in the pipe's decorator and declared it in the `NgModule`.
- If the pipe is standalone or is declared in another `NgModule`, add it to the `imports` field of the standalone component or the current `NgModule`.

- If the pipe is local to the `NgModule`, give it a unique name in the pipe's decorator and declared it in the `NgModule`.
- If the pipe is standalone or is declared in another `NgModule`, add it to the `imports` field of the standalone component or the current `NgModule`.

If you recently added an import or declaration, you may need to restart your server to see these changes.

Expand Down
5 changes: 5 additions & 0 deletions aio/content/errors/NG0403.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
@name Bootstrapped NgModule doesn't specify which component to initialize

@category runtime

@shortDescription An NgModule that was used for bootstrapping does not specify which component should be initialized.

@description

This error means that an NgModule that was used for bootstrapping an application is missing key information for Angular to proceed with the bootstrap process.

The error happens when the NgModule `bootstrap` property is missing (or is an empty array) in the `@NgModule` annotation and there is no `ngDoBootstrap` lifecycle hook defined on that NgModule class.
Expand Down Expand Up @@ -37,6 +40,8 @@ platformBrowser().bootstrapModule(AppModule);
```

@debugging

Please make sure that the NgModule that is used for bootstrapping is setup correctly:

- either the `bootstrap` property exists (and contains a non-empty array) in the `@NgModule` annotation
- or the `ngDoBootstrap` method exists on the NgModule class
4 changes: 4 additions & 0 deletions aio/content/errors/NG0500.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
@name Hydration Node Mismatch

@category runtime

@shortDescription During hydration, Angular expected a DOM node, but either the actual DOM was different or was not found.

@description

This error means that during the hydration process, Angular expected a DOM structure as rendered and annotated during server side rendering. However, on the client, the DOM tree was different than the server rendered DOM tree.

This error typically happens due to direct DOM manipulation using native browser APIs that alter the DOM structure outside of what Angular produced. It will also occur if you use `innerHTML` or `outerHTML` to set HTML content, which similarly alters the DOM structure outside of what Angular produced. You can resolve this by refactoring the component to use native Angular APIs instead of native APIs. If that's not possible, you can add the `ngSkipHydration` attribute to your component's host node, which will disable hydration for the component and its children. `ngSkipHydration` should only be used as a last resort and should be considered a bug that needs to be fixed.
Expand Down Expand Up @@ -35,6 +38,7 @@ export class ExampleCmp {
```

@debugging

The error message in the developer console should contain information on a specific part of the application's DOM structure that is causing the problem. Review that part of the application for hydration-related errors, such as direct DOM manipulation using native APIs.

Check that your template has valid HTML structure. See more information in the [hydration guide](guide/hydration#valid-html-structure).
Expand Down
Loading

0 comments on commit 6b3ddd7

Please sign in to comment.