InterviewHubPRO
Section Overview
Q71

Question 71 of 283

Part 3: Angular Router, Navigation & SSR Universal (63 - 75)

25%
Angular & Signals (283 Qs)•Part 3: Angular Router, Navigation & SSR Universal (63 - 75)

What is activated route?

ActivatedRoute contains the information about a route associated with a component loaded in an outlet. It can also be used to traverse the router state tree. The ActivatedRoute will be injected as a router service to access the information. In the below example, you can access route path and parameters,

javascript
@Component({...})
class MyComponent {
constructor(route: ActivatedRoute) {
 const id: Observable<string> = route.params.pipe(map(p => p.id));
 const url: Observable<string> = route.url.pipe(map(segments => segments.join('')));
 // route.data includes both `data` and `resolve`
 const user = route.data.pipe(map(d => d.user));
}
}