In v1, it was possible to specifiy routes dynamically based on dependencies like:
@autoinject
export class MyComponent {
constructor(
private permissions: Permissions)
{
}
async configureRouter(config: RouterConfiguration, router: Router)
{
if (this.permissions.feature1)
{
routes.push({
route: 'route1',
name: 'route1',
moduleId: PLATFORM.moduleName('./component1')
});
}
if (this.permissions.feature2)
{
routes.push({
route: 'route2',
name: 'route2',
moduleId: PLATFORM.moduleName('./component2')
});
}
config.map(routes);
config.mapUnknownRoutes(routes[0]);
}
}
Is there still a possibility to do that in Aurelia 2? Creating routes using a static property or by using the route decorator doesn’t seem to work for this scenario?
Thanks for any help.