peterbsmyth / ngx-breadcrumbs

Angular 4+ routing breadcrumbs
MIT License
59 stars 43 forks source link

Child routes #15

Closed mjacobson7 closed 6 years ago

mjacobson7 commented 6 years ago

I'm just wondering if this is even possible.

I have a 'Manage Users' route. I also have an 'Edit User' route. I didn't explicitly put the 'Edit User' route as a child of 'Manage Users', because putting a wouldn't make sense in this specific scenario.

However, when you edit a user, the route appears as so: "manage_users/edit_user". When I am on the 'Edit User' route, I am unable to get the breadcrumb bar to display:

Manage Users / Edit User

I believe this is because of the way I have things structured. Is there any way I can get the breadcrumb bar to behave the way I want without adding an actual child route?

mjacobson7 commented 6 years ago

What I did to solve this is make a component-less parent route and put the parent component as a child of said route.

{path: 'manage_users', data: { breadcrumbs: 'Manage Users'}, children: [ {path: '', component: ManageUsersComponent}, {path: 'user/:id', component: UserProfileComponent, data: { breadcrumbs: 'Edit User'}} ]},

I'm going to close this now that I got it working.