You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Which @angular/* package(s) are the source of the bug?
router
Is this a regression?
No
Description
On a route with two children with an empty path, one on a named outlet, the other with a child-redirect, the router seems to activate (and never deactivate?) the named outlet if a canMatch (or canActivate) guard returns false.
This causes the issue that after the initial navigation ("/items/:id") which successfully redirects ("items/:id/main"), every other parallel navigation throws the mentioned error.
If the guard returns true, everything works as expected.
Component/route hierarchy (I'm mixing component and route hierarchy for simplicity):
export const routesWithIssues = [
{
path: ':id'
children: [
{
path: '',
loadComponent: () => ItemComponent,
// initial redirection works,
// navigating to or deep linking to other routes on the same level as "main" causes the error
children: [
// Removing this redirection route solves the issue (but has the side-effect that it doesn't redirect, obviously)
{path: '', pathMatch: 'full', redirectTo: 'main'},
...otherTabbedChildRoutesIncludingMain
]
},
{
path: '',
outlet: 'aside',
// If the guard returns true, no error occurrs.
// (Strange sidenote: only defining `canActivate` breaks routing completely without an error message,
// i.e. only the RootComponent is loaded)
canMatch: [() => false],
loadComponent: () => AsideComponent
},
]
}
] as Routes
Please provide a link to a minimal reproduction of the bug
No response
Please provide the exception or error you saw
Error: NG04013: Cannot activate an already activated outlet
at RouterOutlet.activateWith (router.mjs:2552:19)
at ActivateRoutes.activateRoutes (router.mjs:3146:40)
at router.mjs:3097:18
at Array.forEach (<anonymous>)
at ActivateRoutes.activateChildRoutes (router.mjs:3096:29)
at ActivateRoutes.activateRoutes (router.mjs:3113:22)
at router.mjs:3097:18
at Array.forEach (<anonymous>)
at ActivateRoutes.activateChildRoutes (router.mjs:3096:29)
at ActivateRoutes.activateRoutes (router.mjs:3117:22)
Please provide the environment you discovered this bug in (run ng version)
Which @angular/* package(s) are the source of the bug?
router
Is this a regression?
No
Description
On a route with two children with an empty path, one on a named outlet, the other with a child-redirect, the router seems to activate (and never deactivate?) the named outlet if a
canMatch
(orcanActivate
) guard returns false.This causes the issue that after the initial navigation ("/items/:id") which successfully redirects ("items/:id/main"), every other parallel navigation throws the mentioned error.
If the guard returns true, everything works as expected.
Component/route hierarchy (I'm mixing component and route hierarchy for simplicity):
Please provide a link to a minimal reproduction of the bug
No response
Please provide the exception or error you saw
Please provide the environment you discovered this bug in (run
ng version
)Anything else?
I experimented with trying to deactivate the outlet imperatively, but it didn't work.
The text was updated successfully, but these errors were encountered: