I changed the route from:
{
path: 'detail-component/:Name',
component: DetailComponent,
}
to :
{
path: 'detail-component',
component: DetailComponent,
children: [{ path: ':Name', component: DetailComponent }],
}
I know that both components are the same but I will change the first one to a different component if the user goes to the page without being details on it, it is just a placeholder for now
The problem that i am having is that the activated route does not pass information anymore so the DetailComponent is always empty
I tried to change the route to parent or to first child and it did not work, here is the original code:
export class DetailComponent implements OnInit {
name: any | undefined;
constructor(
private route: ActivatedRoute,
private nameInfoService: nameListService
) {}
ngOnInit(): void {
this.getName();
}
getName(): void {
const name = this.route.snapshot.paramMap.get('Name');
this.nameInfoService
.getMoreData(name)
.subscribe((name) => (this.name = name));
}