I am trying to create a Category Page specific CMS component.
Is there a currentCategoryService that is similar to the CurrentProductService in Spartacus injectables?
If not, what is the correct way to get the current category data (or at least the category code) in my new component?
AFAIK, currently we do not have anything similar to CurrentProductService
for current category. Looking at the implementation of CurrentProductService
you can see that it is using RoutingService
and it's getRouterState()
method (picture 1). You can create something similar for current category, because the router state consists of category informations (as seen below on picture 2).
Picture 1: CurrentProductService
:
Picture 2: Router state contents: