rajaramtt / ng7-dynamic-breadcrumb

Angular 10 Dynamic Breadcrumbs
MIT License
42 stars 31 forks source link

Support for nested routes with parameters #8

Closed cybfox77 closed 3 years ago

cybfox77 commented 5 years ago

I couldn't figure out how to build breadcrumbs with parameters and nested routes: please consider the following:

app-routing.module

    {path: ':id/foo', component: FooComponent, data: {
      breadcrumb: [
          {
            label: 'Home',
            url: '/'
          },
          {
            label: '{{fooName}}',
            // ==> this :id is repeated from the path
            url: '/foo/:id'
          },
        ]}},
    {path: 'foo/:id/bar',
     loadChildren: () => import('./bar/bar.module').then(mod => mod.BarModule)
    },
   ....

bar-routing.module is contains the children routes for 'foo/:id/bar' :

    {path: '', redirectTo: 'list', pathMatch: 'full'},
    {path: 'list', component: BarComponent, data: {breadcrumb: [
           ...
          {
            label: '{{fooName}}',
            // FIXME: cannot get to :id from parent route...
            url: '/foo/:id'
          },
         ... 

So in the child routes, I'd like to access the :id parameter from the parent routes data... Any ideas or suggestions where I should modify the code ?

I'm using the https://github.com/rajaramtt/ng7-dynamic-breadcrumb/tree/master/projects/ng7-dynamic-breadcrumb project

rajaramtt commented 5 years ago

@cybfox77 If possible Please create stackblitz example link!.

cybfox77 commented 5 years ago

Created a stackblitz: https://stackblitz.com/edit/angular-qjsyq5 Can you navigate to 'Go to products' > ' Product 4' => there I would like to display '4' from the parent route. any ideas ?

h33raj commented 4 years ago

Can we take that from the parent route and pass to the child route and pass it to breadcrumb

lenichols commented 4 years ago

+1

rajaramtt commented 3 years ago

Out of the scope, No longer supported by the author this future, If anyone interested, Please submit PR