4
votes

Is it possible to reconfigure a router.navigation to add/remove specific routes, and say have router.navigation automatically update the view?

My use case will be to have a route for multiple pages i.e. /page/A, /page/B and then to allow adding more while the app is running /page/C. I also want the navigation to show those specific pages in the menu: "Page A", "Page B" "Page C"

I believe there are parametrised routes available (route: 'page/:id'). But its not clear if you can give some context to the router.navigation to add some specific routes, via the parametrised route config.

1

1 Answers

1
votes

Try this to add route:

this.router.addRoute({ route: "pageA", moduleId: "views/pageA", nav: true, title: "PageA" });
this.router.refreshNavigation();

To remove: Inspect the Navigation model an remove the route that you want.