AP

Нужно сделать, что бы при доступе — грузить модуль, если нет — пустая страница.
Сделал такой роут и гард — не работает.
Если грузить на другом пути, аля /smth— все ок... но нужно на том же.
Можно ли как-то это пофиксить?
Size: a a a
AP
AP
AP
export const routes: Routes = [
{ path: '', component: SomeComponent },
{ path: ':omg', component: OtherComponent, canActivate: [OmgGuard] },
];
Р
Р
AP
const appRoutes: Routes = [{
path: '',
children: [
{
path: '',
canActivate: [MarketingPageGuard],
loadChildren: './pages/marketing/marketing-page.module#MarketingPageModule'
},
{
path: '',
canActivate: [AuthGuard],
loadChildren: './pages/home/home-page.module#HomePageModule'
}
]
}];
// canActivate method of MarketingPageGuard
canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): boolean {
const canActivate = !this._session.isActive;
if (!canActivate) {
// @ts-ignore
route.parent.routeConfig.children.reverse();
this._router.navigate(['/']);
}
return canActivate;
}
AP
Р
AP
Р
Р
AP
Р
AP
Р
AP
D
D
h
R