Allows accessing the currently activated route from anywhere in the DI hierarchy.
Contrasted to simply injecting ActivatedRoute
, this will be accurate even from outside the router outlet.
Note that this service operates by listening to router events. It is therefore recommended to
inject this service in the root and subscribe to route$
on app init so that all routing events are captured.
The consumer can then subscribe at any later time (after all navigations) and the emission stream will be replayed.
provideDaffRouterActivatedRoute
is the recommended way to do this.
Name | Type | Description |
---|---|---|
route$ | Observable<ActivatedRoute> |