While working on setting up a router in my application, I encountered the need to define a query parameter that must be retrievable through the ActivatedRoute for compatibility reasons. Recently, I had to create some new sub-routes that do not follow the same routing logic.
// Although works when 'myParam' is selected, no param sent
{
path: "myParam",
component: "MyComponent"
}, {
path: ":param",
children: [{/* */}]
}
//...
// Doesn't function if first guard is not satisfied
{
path: ":param",
component: "MyFirstComponent",
canActivate: [myGuardService]
}, {
path: ":param",
canActivate: [myOtherGuardService],
children: [{/* */}]
}
//...
Initially, I attempted to specify specific routes before the generic one, but the parameter was not being sent. Then, I tried implementing a guard on each route at the same level, however, if the first guard does not pass using the input, the route becomes inaccessible. It may sound straightforward, but I am struggling to find a solution with minimal changes in the code. Any assistance would be greatly appreciated.