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

  1. @Component({templateUrl:'./my-component.html'})
  2. class MyComponent {
  3. constructor(route: ActivatedRoute) {
  4. const id: string = route.snapshot.params.id;
  5. const url: string = route.snapshot.url.join('');
  6. const user = route.snapshot.data.user;
  7. }
  8. }

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[]
toString() : string

}

Interface Description

Interface Details

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