What is the difference between ActivatedRoute and ActivatedRouteSnapshot in Angular4

Since ActivatedRoute can be reused, ActivatedRouteSnapshot is an immutable object representing a particular version of ActivatedRoute. It exposes all the same properties as ActivatedRoute as plain values, while ActivatedRoute exposes them as observables. Here is the comment in the implementation: export class ActivatedRoute { /** The current snapshot of this route */ snapshot: ActivatedRouteSnapshot; If … Read more

Do I have to unsubscribe from ActivatedRoute (e.g. params) observables?

No From the docs : When subscribing to an observable in a component, you almost always arrange to unsubscribe when the component is destroyed. There are a few exceptional observables where this is not necessary. The ActivatedRoute observables are among the exceptions. The ActivatedRoute and its observables are insulated from the Router itself. The Router … Read more

How do I navigate to a sibling route?

If you are using the new router (3.0.0-beta2), you can use the ActivatedRoute to navigate to relative path as follow: constructor(private router: Router, private r:ActivatedRoute) {} /// // DOES NOT WORK SEE UPDATE goToContact() { this.router.navigate([“../contacts”], { relativeTo: this.r }); } Update 08/02/2019 Angular 7.1.0 current route: /department/7/employees/45/sales the old version will do: /department/7/employees/45/sales/contacts As … Read more