I am trying to set up a browser to browse through a tree. Every time a leave is selected, its children can be selected.
Since I want to make generic, I only want to specify one route.
Unfortunatly, that does not really work... This works
RouterModule.forRoot( [
{ path: '', redirectTo: '/browser', pathMatch: 'full' },
{
path: 'browser', children: [
{
path: '',
component: BrowserComponent
},
{
path: '**',
component: BrowserComponent
}
]
},
] )
But then I am not able to read the params. This prints an emtpy object
this.route.params.forEach((params: Params) => {
console.log(params);
});
I think it should be something like this:
{ path: '**/:id', component: BrowserComponent }
But that does also not work..:/ Can somebody tell me what I'm doing wrong? Thanks in advance.
PS: In rails I would do it like this:
get 'browser/*id',
this.route's type?ActivatedRoute?this.routeis declared in the costructorprivate route: ActivatedRoute