Im working in Angular 2 Dart, but I should be able to translate any JS or TS examples.
1) How can I gain a list of all the registered routes?
2) How can I delete a route from the registered routes?
I know I can dynamically add via something like this:
...
final Router router;
AppComponent(this.router){
this.router.config([
Route(path: '/Page-0', component: Page0Route, name: 'Page-0')
]);
}
...
But yet to work out listing and removing routes.
As far as I know there is currently no official way. The RouteRegistry contains the configured routes but it doesn't provide public members to access them and in Dart you can't access private fields like you can in TypeScript to work around this limitation.
The only workaround that I see is to extend the RouteRegistry class and add your custom implementation as provider for the RouteRegistry type, after ROUTE_PROVIDERS to ensure your custom implementation is taken instead.
I haven't tried this yet though.
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