Hi,
I was wondering if it was possible to access/retrieve the 'data' property of a route (set up when configuring routes) without actually visiting the route?
So for example, say I have a route configuration as such:
export const HeroesRoutes: RouterConfig = [
{ path: 'about', component: AboutComponent },
{ path: 'heroes', component: HeroListComponent },
{ path: 'hero/:id', component: HeroListComponent, data: ["authorized"] }
];
now let's say I'm on the 'about' route, but from the AboutComponent, I want to have a method/service available such that I can map
"/hero/5" ----to----> ["authorized"]
Basically I want to map the string representation of an arbitrary route to its associated data property, without having ever visited that route. One way I know to do it is to use the RouterConfig object and traverse the tree myself by deconstruct the string route myself. But is there an easier way?
Thanks!