0

I have the following route:

{
path: 'introducer/:introducerId/branches/create',
component: IntroducerBranchesCreateComponent,
data: {
  pageTitle: 'Add branch',
  breadcrumbs: [
    { title: 'Branches', link: '/introducer/' + :introducerId + '/branches' },
    { title: 'Add', link: '' },
  ],
},
},

In the breadcrumbs array I would like to populate the link property using the route param :introducerId but have been unable to do so. Is there a way to do this?

1 Answer 1

2

I am not 100% sure if this would work but you could try something

{
    path: 'introducer/:introducerId/branches/create',
    component: IntroducerBranchesCreateComponent,
    data: {
        pageTitle: 'Add branch',
        breadcrumbs: () => {
            const id = this.getIntroducerId();

            return [
                { title: 'Branches', link: `/introducer/${id}/branches` },
                { title: 'Add', link: '' },
            ]
        }
    },
}

And then add the method getIntroducerId to your component, and make your usage of data.breadcrumbs call it as a function instead of just using the object property.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.