Skip to content

Recreating custom element loads wrong route #36711

@jsBrian

Description

@jsBrian

🐞 bug report

Affected Package

@angular/elements
@angular/router

Is this a regression?

No, as far is I know this issue was present in @angular/elements 6, 7, 8 and 9.

Description

When using custom-elements along with routing, there seems to be an issue when you:

  • create a custom element (that has routing) and add it to the page
  • do some routing, but make sure to back to the root of the app
  • delete the custom element
  • create a new element with the same tag name
  • instead of showing the root of the app, it opens one of the child routes and routing breaks

The minimal reproduction should make the issue much more clear.

🔬 Minimal Reproduction

https://stackblitz.com/edit/angular-elements-official-example-r3ipbj

🔥 Exception or Error

No error is present

Anything else relevant?
The issue also seem to arise when you reuse the old custom element. But only when you remove and add it twice.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions