Навигация по угловому маршрутизатору не работает после нажатия «Вернуться на одну страницу» в браузере. - PullRequest
0 голосов
/ 21 октября 2019

У меня есть список элементов, которые Onclick="()" открывают раздел сведений об этом конкретном элементе, раздел сведений является отложенной загрузкой, но у меня возникает проблема, когда я нажимаю кнопку «Вернуться на одну страницу» (кнопка «Назад»)из браузера), изменение маршрутизатора и раздел сведений закрыты, но я не могу открыть снова, если я нажимаю на элемент, и маршрут не изменяется.

module.routing

const routes: Routes = [
  {
    path: '',
    component: BacklogComponent,
    children: [
      { path: 'details/ie/:id', redirectTo: 'details/ie/:id/DETAILS', pathMatch: 'full' },
      {
        path: 'details/ie/:id/:detailsSection',
        loadChildren: () => import('../lazy/backlog-item-details-ie.module').then((mod) => mod.BacklogItemDetailsIeModule),
        data: { preload: true, delay: 2500 }
      },
      { path: 'details/:id', redirectTo: 'details/:id/DETAILS', pathMatch: 'full' },
      {
        path: 'details/:id/:detailsSection',
        loadChildren: () => import('../lazy/backlog-item-details.module').then((mod) => mod.BacklogItemDetailsModule),
        data: { preload: true, delay: 2500 }
      },
      { path: 'configuration', loadChildren: () => import('../lazy/configuration.module').then((mod) => mod.ConfigurationModule) }
    ]
  }
];

Выберите пункт

  public selectItem(event: MouseEvent, position: DetailSections) {
    this.log.trace(`selectItem() in backlog item comp. id: ${this.backlogItem.id}`);
    this.eventService.hideBoardCreator.emit();
    // as the click to these events are bound on the DOM on childs of the click to the details -> we need to stop the event here
    // if TS on other card is shown, it needs to be hidden
    event.stopPropagation();

    // save selection into store
    this.store.dispatch(new BacklogItemSelected(this.backlogItem));

    // show the details section
    if (!this.configService.appConfig.platform.TRIDENT) {
      this.router.navigate([`HyPE4PM/${this.configService.boardtype}/details`, this.backlogItem.id, DetailSections[position]]);
    } else {
      this.router.navigate([`HyPE4PM/${this.configService.boardtype}/details/ie`, this.backlogItem.id, DetailSections[position]]);
    }

    this.cd.detectChanges();
  }
...