ActivatedRoute

Stable

Interface

What it does

Contains the information about a route associated with a component loaded in an outlet. An ActivatedRoute can also be used to traverse the router state tree.

How to use

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

Interface Overview

interface ActivatedRoute {
snapshot : ActivatedRouteSnapshot
url : Observable<UrlSegment[]>
params : Observable<Params>
queryParams : Observable<Params>
fragment : Observable<string>
data : Observable<Data>
outlet : string
component : Type<any>|string
routeConfig : Route
root : ActivatedRoute
parent : ActivatedRoute
firstChild : ActivatedRoute
children : ActivatedRoute[]
pathFromRoot : ActivatedRoute[]
paramMap : Observable<ParamMap>
queryParamMap : Observable<ParamMap>
toString() : string

}

Interface Description

Interface Details

exported from router/index, defined in router/src/router_state.ts