Skip to content

fix(router): remove previous classes when routerLinkActive changes - #71349

Open
MeAkib wants to merge 1 commit into
angular:mainfrom
MeAkib:router/router-link-active-stale-classes
Open

MeAkib wants to merge 1 commit into
angular:mainfrom
MeAkib:router/router-link-active-stale-classes

Conversation

@MeAkib

@MeAkib MeAkib commented Oct 14, 2026

Copy link
Copy Markdown
Contributor

When the routerLinkActive input changed while the link was active, the classes applied for the previous value stayed on the element, because only the current classes are added or removed on update. Binding the input to a value that switches to null therefore never removed the active class.

Remove the classes that are no longer part of the input when it changes.

Fixes #71348

When the `routerLinkActive` input changed while the link was active, the
classes applied for the previous value stayed on the element, because
only the current classes are added or removed on update. Binding the
input to a value that switches to `null` therefore never removed the
active class.

Remove the classes that are no longer part of the input when it changes.

Fixes angular#71348
@pullapprove
pullapprove Bot requested a review from crisbeto October 14, 2026 09:54
@ngbot ngbot Bot added this to the Backlog milestone Oct 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

RouterLinkActive keeps the previous classes when its input changes while the link is active

1 participant