With Angular2, how would I retrieve the current active component and path?
For example I might have the following routes:
{ path: \'\', component:
Yah, the angular 2 starter guide covers all that, basically you need to inject ActivatedRoute on your component then you can retrieve the information you want by subscribing to the route params.
I would really recommend you to do the angular tutorial tour of heroes, it is actually pretty good learning material that they provided.
Inject ActivatedRoute, on your component constructor:
constructor(private route: ActivatedRoute) {
}
ngOnInit() {
this.route.params.subscribe(params => {
console.log(params['id']);
});
}