const queryParamToModalMap: Record<ModalCode, ComponentType<unknown>> = {
'atlas-item': PopupAtlasItemComponent,
'medialib-item': PopupMedialibItemComponent,
'news-item': PopupNewsItemComponent,
'search': PopupSearchItemComponent,
};
this.activatedRoute.queryParams
.pipe(untilDestroyed(this))
.subscribe(params => {
let noOneKnownModalsInParams = true;
Object.keys(params).forEach(paramName => {
const modalCmp = queryParamToModalMap[paramName];
if (!modalCmp) {
return;
}
noOneKnownModalsInParams = false;
this.modalsService.open(paramName, modalCmp, {code: params[paramName]});
});
if (noOneKnownModalsInParams) {
Object
.keys(queryParamToModalMap)
.forEach(modalCode => this.modalsService.close(modalCode));
}
});
<a class="article d-block" [routerLink]='item?.url'>
{
path: 'services/atlas/:sectCode',
loadChildren: () => import('./pages/atlas/page-atlas/page-atlas.module').then(m => m.PageAtlasModule)
},
{
path: 'services/atlas',
loadChildren: () => import('./pages/atlas/page-atlas/page-atlas.module').then(m => m.PageAtlasModule)
},
RouterModule.forChild([{path: '', component: PageAtlasComponent}])
this.router.events
, а именно наinstanceof NavigationStart
. ЯNavigationStart
и подобное вообще не использую, поэтому сначала даже не обратила внимание, не знала, что искать. Спасибо.