How to handle route parameters in angular?

71 Views Asked by At

My app is redirecting to "localhost:4200/teams/team1" on a button click where I initialize paramValue(name) and is loading proper component also, But when I refresh browser, it is not able to fetch route param value(name) and it redirects to PageNotFoundComponent. Please help me find the solution.

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

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

];
0

There are 0 best solutions below