angular: Update error message for an unknown tag in standalone components

Which @angular/* package(s) are the source of the bug?

core

Is this a regression?

No

Description

Currently the error for unknown element tags looks like follows:

src/app/app.component.ts:7:14 - error NG8001: 'admin-s' is not a known element:
1. If 'admin-s' is an Angular component, then verify that it is part of this module.
2. If 'admin-s' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message.

7   template: '<admin-s></admin-s>',

This error message needs to be updated for standalone components to:

  • mention @Component.imports / `@Component.schemas’
  • not mention NgModule

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 15 (11 by maintainers)

Commits related to this issue

Most upvoted comments

@dario-piotrowicz great, thanks a lot for submitting 2 PRs! 👍

I had a quick look at the JIT PR and I’m sorry that it turned out a bit more involved. I was thinking that we already have the necessary information somewhere close to the code that throws an error. The change in the PR makes sense, I’ll perform additional review asap and let you know if there is any feedback.

Thank you.

Go @dario-piotrowicz , go! I’ve updated the issue description (it was badly formatted, sorry about that).

The basic idea is to determine the type of a component (standalone or not) and adjust the error message based on this type (the standalone flag can be read from the component def).

LMK if you’ve got any questions.

@nthypes Thank you so very much, you’re too kind! 🙏

@dario-piotrowicz just wanted to ask if you might be interested in submitting a PR to improve the error message?

Of course!!! 😀

Please leave this with me! 🙂