Skip to content

Commit

Permalink
docs: add standalone details to NG0302 (#46090)
Browse files Browse the repository at this point in the history
improve the error information of NG0302 by including details about
standalone pipes (and components)

PR Close #46090
  • Loading branch information
dario-piotrowicz authored and AndrewKushnir committed Jun 15, 2022
1 parent 463feb6 commit ba4f3aa
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
17 changes: 11 additions & 6 deletions aio/content/errors/NG0302.md
@@ -1,20 +1,25 @@
@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 referenced in the template has not been named or declared properly.
A [pipe](guide/pipes) must be either declared or imported in the `NgModule` where it is used, and the name used in a template must match the name defined in the pipe decorator.

In order for a [pipe](guide/pipes) to be used:
- it must be declared as a part of an `NgModule` (added to the `declarations` array) or marked as standalone (by adding the `standalone: true` flag to the Pipe decorator).
- it must be imported in an `NgModule` or a standalone component where it is used.
- the name used in a template must match the name defined in the Pipe decorator.

@debugging
Use the pipe name to trace the templates or modules where this pipe is declared and used.
Use the pipe name to trace where the pipe is declared and used.

To resolve this error, ensure that:

* A local custom pipe is uniquely named in the pipe's decorator, and declared in the `NgModule`, or
* A pipe from another `NgModule` is added to the imports of the `NgModule` where it is used
- If the pipe is local to the `NgModule`, it is uniquely named in the pipe's decorator and declared in the `NgModule`.
- If the pipe is standalone or from another `NgModule`, it is added to the `imports` field of the current `NgModule` or standalone component.

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

Expand All @@ -24,4 +29,4 @@ If you recently added an import or declaration, you may need to restart your ser

<!-- end links -->

@reviewed 2022-02-28
@reviewed 2022-05-22
@@ -0,0 +1,3 @@
module.exports = function() {
return {name: 'videoCaption'};
};
1 change: 1 addition & 0 deletions aio/tools/transforms/templates/error/error.template.html
Expand Up @@ -17,6 +17,7 @@ <h1>{$ doc.code $}: {$ doc.shortDescription $}</h1>
allowfullscreen></iframe>
</div>
{% endif%}
{% if doc.videoCaption %}{$ doc.videoCaption | marked $}{% endif%}

<div class="error-description">
<h2>Description</h2>
Expand Down

0 comments on commit ba4f3aa

Please sign in to comment.