且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Angular 2路线更改为相同组件导致重新加载

更新时间:2023-02-13 18:00:53

我遇到了同样的问题,因此这是我的解决方案.希望对您有所帮助.

I have the same issue so here is my solution. Hope it helps.

    {
      path: '',
      redirectTo: 'home/',
      pathMatch: 'full',
    },
    {
      path: 'home',
      redirectTo: 'home/',
      pathMatch: 'full',
    },
    {
      path: 'home/:id',
      component: HomeComponent,
    }