首页 > 解决方案 > 如何以角度处理路由参数?

问题描述

我的应用程序在单击按钮时重定向到“localhost:4200/teams/team1”,在该按钮上我初始化了 paramValue(name) 并且也在加载正确的组件,但是当我刷新浏览器时,它无法获取路由参数值(name)它重定向到 PageNotFoundComponent。请帮我找到解决方案。

const routes: Routes = [
  {path:'',component:LandingPageComponent},
  {path:'teams/:name', canActivate:[AuthGuard], component: TeamComponent},

  {path:'error-handler',component:ErrorHandlerComponent},
  {path: '**', component:PageNotFoundComponent ,pathMatch:'full'}

];

标签: angularrefreshpage-refreshangular7-router

解决方案


推荐阅读