Imagine a scenario where there is a menu containing various items. Each time the user clicks on a menu item, they are redirected to a specific URL. However, if the user clicks on the same menu item again, the component should be reloaded and all previously entered variables should be cleared.
reloadURL(URL_DESTINATION){
router.routeReuseStrategy.shouldReuseRoute = () => false;
router.onSameUrlNavigation = 'reload';
router.navigate([URL_DESTINATION], { relativeTo: route });
Here is my app-routing setup:
path: environment.URL_STUDENT, canActivate: [AuthGuard], children: [
{
path: environment.Url_A, loadChildren: () => ....
},
{
path: environment.URL_B, loadChildren: () => ...
}]
},
@NgModule({
imports: [RouterModule.forRoot(routes)
],
exports: [RouterModule]
})
The issue arises when the user clicks on the same link (A) for the first time everything works fine, but when they switch to another link (B), instead of loading component B, component A gets loaded. Can anyone provide assistance with this problem?