I need to reload the current route. I read many posts and the solution below works for me when I am reloading routes that are not defined as the default route of the app-
this.router.navigateByUrl('/', {skipLocationChange: true}).then(() =>
this.router.navigate([XXXX])
);
But for the default route this does not work for some reason, any ideas why?
My app-routing.module (output is my default route, and it is by lazy loading).
const appRoutes: Routes = [
{
path: 'login',
component: LoginComponent
},
{
path: 'loginError',
component: LoginErrorComponent
},
{ path: 'settings',
loadChildren: './settings/settings.module#SettingsModule',
canActivate: [AuthGuard],
},
{ path: 'output',
loadChildren: './researcher-output-list-standalone/researcher-output-list-standalone.module#ResearcherOutputListStandaloneModule',
canActivate: [AuthGuard],
},
{ path: '',
redirectTo: 'output',
pathMatch: 'full',
canActivate: [AuthGuard],
},
{ path: '**',
redirectTo: 'output',
canActivate: [AuthGuard],
},
];