angular routes options code example

Example 1: pathmatch angular

content_copy
      
      [{
  path: '',
  pathMatch: 'full',
  redirectTo: 'main'
}, {
  path: 'main',
  component: Main
}]

Example 2: angular routing url params

const appRoutes: Routes = [
  { path: 'crisis-center/:param1', component: CrisisListComponent },
  { path: 'hero/:param2',      component: HeroDetailComponent },
];

@NgModule({
  imports: [
    RouterModule.forRoot(
      appRoutes,
      { enableTracing: true } // <-- debugging purposes only
    )
    // other imports here
  ],
  ...
})
export class AppModule { }