ActivatedRouteSnapshot

Stable

Interface

What it does

Contains the information about a route associated with a component loaded in an outlet at a particular moment in time. ActivatedRouteSnapshot can also be used to traverse the router state tree.

How to use

@Component({templateUrl:'./my-component.html'}) class MyComponent { constructor(route: ActivatedRoute) { const id: string = route.snapshot.params.id; const url: string = route.snapshot.url.join(''); const user = route.snapshot.data.user; } }

Interface Overview

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

}

Interface Description

Interface Details

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