I would like to know if it is possible to dynamically append child routes at run time, from lets say a service...?
Given:
const routes: Routes = [
    {
        path: '', component: GloriousComponent,
        children: [
           { path: 'path1', component: Child1Component },
           { path: 'path2', component: Child2Component },
           { path: 'path3', component: Child3Component },
        ]
    }
];
Could I remove the children of the ' ' path and somehow get a reference to the const routes and then later on dynamically append children to the ' ' path?
Something along the lines of...
const routes: Routes = [
    {
        path: '', component: GloriousComponent           
    }
];
routes[''].appendChildren(
        [
           { path: 'path1', component: Child1Component },
           { path: 'path2', component: Child2Component },
           { path: 'path3', component: Child3Component },
        ]
    )
                Currently modifying is not supported but you can maintain a list of routes yourself and then call
this.router.resetConfig(routes)
to load a new set of routes into the router.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With