Attempting to navigate using an Angular router to a link with an id, I have inserted a link with an id in the routing module. However, it is not functioning as expected.
I have experimented with two different ways of implementing routes:
{ path: 'user/:id', component: UserPage}
and { path: '/user/:id', component: UserPage}
, but neither option seems to be working.
const routes: Routes = [
{ path: 'user/:id', component: UserPage}
];
userClick(id: number) {
this._router.navigate([`/user`, id]);
}