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?
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.