I have an Angular2 app that uses the Router, with the standard setup pattern in app.routes.ts:
const appRoutes: Routes = [
{
path: '',
redirectTo: '/login',
pathMatch: 'full'
},
{
path: 'login',
component: LoginComponent
},
...other static routes...
];
export const Routing: ModuleWithProviders = RouterModule.forRoot(appRoutes);
But my App has some routes that are not in the static appRoutes array. They are loaded using an injectable Service called CmsService that runs as an APP_INITIALIZER and stores its result as a public property CmsService.pages on itself, according to How to pass parameters rendered from backend to angular2 bootstrap method and the comments below.
Now I am trying to figure out how to use this service in app.routes.ts, but I can't figure out what kind of animal this file actually is? The examples I can Google on how to use injectable services are all for Components, but app.routes.ts is something else and I am at loss on how to add the routes from CmsService.pages into the appRoutes array before the Router is initialized.