angular routerlink on non routed component code example

Example 1: 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 { }

Example 2: this.router.navigate

<a [routerLink]="['/', 'red-pill', {x: 'white-rabbit'}, 'neo']">
  Param!
</a>

Tags:

Html Example