I would retrieve a parameter from my route path in Angular 5
http://localhost:4200/#/dashboard/74618/LastCC
I would get 74618 from route which is an id parameter.
I have processed like this
constructor(public activatedRoute: ActivatedRoute)
this.activatedRoute.paramMap.subscribe(params => {
console.log("params******");
params.get("id");
});
I get undefined as value.
It's working when I'm on this path http://localhost:4200/#/dashboard/74618/ (Without \LastCC )
LastCC is lazy Loaded and here's the router config:
const routes: Routes = [
{
path: "",
component: CreditPointComponent
}
];
@NgModule({
imports: [RouterModule.forChild(routes)],
exports: [RouterModule]
})
export class CreditPointRoutingModule {}
The id parameter is on the parent module router configuration ( Dashboard module ).
const routes: Routes = [
{
path: ":id",
component: DashboardComponent,
children: [
{
path: "LastCC",
loadChildren:
"app/useful-documents/credit-point/credit-point.module#CreditPointModule"
}
]
}
];