RouterState

Stable

Interface

What it does

Represents the state of the router.

How to use

  1. @Component({templateUrl:'template.html'})
  2. class MyComponent {
  3. constructor(router: Router) {
  4. const state: RouterState = router.routerState;
  5. const root: ActivatedRoute = state.root;
  6. const child = root.firstChild;
  7. const id: Observable<string> = child.params.map(p => p.id);
  8. //...
  9. }
  10. }

Interface Overview

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

}

Interface Description

Interface Details

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