Angular ActivatedRoute VS Angular Router

Viewed 4134
  1. What is the difference between Angular router class and angular activated route class?
  2. when to use this above class?
1 Answers

Angular Router is a service that presents a particular component view for a given URL. The Router interprets the URL in the browser and handles navigation to the configured component. After the end of each successful navigation lifecycle, the router builds a tree of ActivatedRoute objects that make up the current state of the router.

AcivatedRoute in an injectable service that provides access to information about a route associated with a component such as the route path and URL parameters in the component.

Both of them are included in the package '@angular/router'. You can read more in the Angular Docs.

Related