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!
--
You received this message because you are subscribed to the Google Groups
"Angular and AngularJS discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.