rajaramtt / ng7-dynamic-breadcrumb

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

Dynamic breadcrumb #1

Closed EL-Yapany closed 5 years ago

EL-Yapany commented 5 years ago

I'm in case that I have a route that may be reached from multiple routes..so how can I manage previous (parent) name in the breadcrumb dynamically ?

rajaramtt commented 5 years ago

Add a name to your route by adding a breadcrumb property in the route's data:

{
        path: '',
        component: ParentComponet,
        children: [
            {
                path: 'child',
                component: ChildComponent,
                data: {
                    title: 'Child Page',
                    breadcrumb: [
                        {
                            label: 'Parent', 
                            url: '/parent' // parent link
                        },
                        {
                            label: 'Child',
                            url: '/parent/child' // child link
                        }
                    ]
                },
            },
        ],
    },

More information, Please check stackblitz example: https://stackblitz.com/edit/ng7-dynamic-breadcrumb