UrlSegment

Stable

Class

What it does

Represents a single URL segment.

How to use

  1. @Component({templateUrl:'template.html'})
  2. class MyComponent {
  3. constructor(router: Router) {
  4. const tree: UrlTree = router.parseUrl('/team;id=33');
  5. const g: UrlSegmentGroup = tree.root.children[PRIMARY_OUTLET];
  6. const s: UrlSegment[] = g.segments;
  7. s[0].path; // returns 'team'
  8. s[0].parameters; // returns {id: 33}
  9. }
  10. }

Class Overview

class UrlSegment {
constructor(path: string, parameters: {[name: string]: string})
path : string
parameters : {[name: string]: string}
toString() : string

}

Class Description

Constructor

constructor(path: string, parameters: {[name: string]: string})

Class Details

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