镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

Angular Router throwing error when compiling. Angular v.22.22.1 #34249

Description

@GovernorBrown

Command

serve

Is this a regression?

  • [no]
  • Yes, this behavior used to work in the previous version

The previous version in which this bug was not present was

No response

Description

Working with Angular standalone components. My app is set up to use Router Outlet for navigation; i have injected it into the main app component for the angular project. I have defined my routes and they work. I have added a new route/component to the pre-existing routes/component that loads onInit of the angular application. This new component imports and uses Router for navigation. The compiler throws the error: [ERROR] NG2012: Component imports must be standalone components, directives, pipes, or must be NgModules. Going back to the .ts file for the entry component and saving the files fixe the error, but prevents entry component from displaying.

Entry component displaying correctly without errors before integrating Router:

Image

Error shown after incorporating Router:
Image

Webpage shown after saving component's ts file; Entry comoponent no longer showing:

Image

It seems to be an error during compiling. All the other routes that have been defined still work correctly. What is the cause of this one particular route's defect?

Minimal Reproduction

ng serve caused the error

Exception or Error


Your Environment

v.22.22.1

Anything else relevant?

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions