router link with params angular 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 }
)
],
...
})
export class AppModule { }
Example 2: router link with params
<!-- Import in module... -->
imports: [
RouterModule,
....
],
<!-- HTML -->
<button [routerLink]="['profile', user.id]"........