Back when using the deprecated router I was able to do a router.config and pass in an object. Thing is, the router itself got configured a bit after the app was started, the object had the same "template" as if I'd used the @RouterConfig. What I'm looking for is if there is a way to config the new router like this. Been looking through the documentation but I'm a bit at a loss since it isn't documented yet.
Edit due to answer
No, I can't use @Routes. Thing is I'm loading the configuration after the construction of the router. Here is a snipped of how I did it with the old router:
myLoader.loadComponentConfig(configPath)
.then(components => { self.Components = components;
components.map(comp => {
self.RouterComponents.push(
{
path: '/' + comp.name,
component: comp,
as: comp.name
}
)});
router.config(self.RouterComponents);
});
As you can see, I'm building myself a json object ( RouterComponents ) and then sending it to the router. I'm looking for a way to do the same with the new router, or something alike.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…