Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Breadcrumb after dynamic param #6

Closed
Hesesses opened this issue Jul 18, 2019 · 4 comments
Closed

Breadcrumb after dynamic param #6

Hesesses opened this issue Jul 18, 2019 · 4 comments
Assignees

Comments

@Hesesses
Copy link

Hello, my routes looks like this:

const routes: Routes = [
  {path: '', pathMatch: 'full', component: UsersComponent, data: {breadcrumb: 'Users'}},
  {path: 'add', component: AddUserComponent, data: { breadcrumb: 'Add new'}},
  {path: ':userId', component: ShowUserComponent, data: {breadcrumbAlias: 'userFullname'}},
  {path: ':userId/edit', component: EditUserComponent, data: {breadcrumbAlias: 'userFullname', breadcrumb: 'Edit'}}
];

How to setup the last route to have breadcrumb like:
Users / Full Name / edit

I have tried different things like the one above without success

@udayvunnam udayvunnam self-assigned this Jul 18, 2019
@udayvunnam
Copy link
Owner

@Hesesses

I have added the ability to add breadcrumbs for the base route, in the above example 'Users', with v2.0.0. Please update to the latest.

:userId and :userId/edit are siblings in your example, so only one of the route(breadcrumbs) would be considered at a time. Can you try declaring your routes like below, It should work!

const routes: Routes = [
  { path: '', pathMatch: 'full', component: UserComponent, data: { breadcrumb: 'Users' } },
  { path: 'add', component: AddUserComponent, data: { breadcrumb: 'Add new' } },
  {
    path: ':userId',
    data: {
      breadcrumbAlias: 'username'
    },
    children: [
      {
        path: '',
        component: ShowUserComponent,
        data: { breadcrumbAlias: 'userFullname' }
      },
      {
        path: 'edit',
        component: EditUserComponent,
        data: { breadcrumbAlias: 'userFullname', breadcrumb: 'Edit' }
      }
    ]
  }
];

I have tested your use case for Users / FullName / edit which worked with the above changes.

@udayvunnam udayvunnam pinned this issue Jul 20, 2019
@udayvunnam
Copy link
Owner

udayvunnam commented Jul 20, 2019

Check the Demo App routes and breadcrumb mapping - https://github.com/udayvunnam/xng-breadcrumb/tree/master/projects/xng-breadcrumb-app/src/app

You can also play with the deployed demo app to check breadcrumbs - https://xng-breadcrumb.netlify.com/mentee/2/edit

@udayvunnam
Copy link
Owner

@Hesesses let me know if you still face any issues

@Hesesses
Copy link
Author

works fine, thank you very much!

@udayvunnam udayvunnam unpinned this issue Nov 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants