I'm building an app with angular2 alpha27 and systemjs. It's supposed to be a big app one day and many components are supposed to use links inside the app. For the moment, to determine the router config I put this into app.ts
:
@RouteConfig([
{ path: '/', as: 'overview', component: Overview },
{ path: '/requests', as: 'requests', component: Requests },
{ path: '/pane', as: 'pane', component: Pane }
])
The problem:
If I need in other components to put a link to Overview like this <a router-link="overview">Overview</a>
I have to import to that component all router injectables and define RouterConfig and import components (like Overview, Pane, etc.. mentioned above) to make linking work.
First, it doesn't make any sense to import all these to several components that only need a link to Overview, for example.
Second, I would like to define my @RouterConfig
only once for maintenance reasons.
The idea I have is to make a service, that would define @RouterConfig
and make it available to any component. But I have no idea, how to do this.
Please, would anyone have an idea of the best way of arranging such code?