RouterState

Stable

Interface

What it does

Represents the state of the router.

How to use

@Component({templateUrl:'template.html'}) class MyComponent { constructor(router: Router) { const state: RouterState = router.routerState; const root: ActivatedRoute = state.root; const child = root.firstChild; const id: Observable<string> = child.params.map(p => p.id); //... } }

Interface Overview

interface RouterState extends Tree {
snapshot : RouterStateSnapshot
toString() : string

}

Interface Description

Interface Details

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