The Angular 2+ (4) tutorial on routing demonstrates making the router
a private member like this:
constructor(
private router: Router, // <- router is private
private heroService: HeroService) { }
...
) {}
However, it does not explain the reason behind making the router private in this context. This may make testing more challenging, so what could be the rationale for keeping it private? Is it purely a matter of best practice, or could there be security implications if made public?
In addition, how do you test routing to ensure proper navigation under different conditions? The tutorial does not address testing of router/routes at all.