This is an angular 2 component that creates a breadcrumb trail. It hooks into the angular2/router, to dynamically build up the crumb trail once a component is routed to.
When I do breadcrumbService.addCallbackForRouteRegex and have console.log(id) in the callback function to determine what value it's actually picking up, it returns gloves or gloves-latex as the ID.
I can still work with this, in fact it saves me a step from having to query the API for the section or category name by ID because I can just transform the string by removing the dashes and making it Uppercase. However I have a distinct feeling this is not how it's supposed to work.
I've got routes that are like these:
/products/section/4/gloves /products/category/180/gloves-latex
When I do
breadcrumbService.addCallbackForRouteRegex
and haveconsole.log(id)
in the callback function to determine what value it's actually picking up, it returnsgloves
orgloves-latex
as the ID.I can still work with this, in fact it saves me a step from having to query the API for the section or category name by ID because I can just transform the string by removing the dashes and making it Uppercase. However I have a distinct feeling this is not how it's supposed to work.
My routing config for those pages are like so:
section/:section/:secName
category/:category/:catName
How do I get the the first param instead of the second one?