UrlTree

Stable

Interface

What it does

Represents the parsed URL.

How to use

  1. @Component({templateUrl:'template.html'})
  2. class MyComponent {
  3. constructor(router: Router) {
  4. const tree: UrlTree =
  5. router.parseUrl('/team/33/(user/victor//support:help)?debug=true#fragment');
  6. const f = tree.fragment; // return 'fragment'
  7. const q = tree.queryParams; // returns {debug: 'true'}
  8. const g: UrlSegmentGroup = tree.root.children[PRIMARY_OUTLET];
  9. const s: UrlSegment[] = g.segments; // returns 2 segments 'team' and '33'
  10. g.children[PRIMARY_OUTLET].segments; // returns 2 segments 'user' and 'victor'
  11. g.children['support'].segments; // return 1 segment 'help'
  12. }
  13. }

Interface Overview

interface UrlTree {
root : UrlSegmentGroup
queryParams : {[key: string]: string}
fragment : string
toString() : string

}

Interface Description

Interface Details

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