angular route with url parameters 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: angular set url parameters
<a href="javascript:;" routerLink="/link/params">
My link
</a>
{path: '/link/:paramsName', component: MyComponent }