Accessing router routes

Currently I’m trying to access the settings of a specifc route that I want to search by name…
but I’m not able to iterate the routes and don’t know why:

public class testValueConverter{
    public constructor(private router: Router){}

    toView(value){
        this.router.routes.forEach(route => console.log(route));
    }
}

When I only call console.log(this.router.routes) I get an array of all configured routes.
Can anyone tell my why I’m not able to access a specific route (in value converter)?

When I only call console.log(this.router.routes) I get an array of all configured routes.
Can anyone tell my why I’m not able to access a specific route (in value converter)?

Value converter are singleton application wise, which means what you injected in that TestValueConverter is actually root router, which is AppRouter instance.

1 Like