UrlSegment

Stable Class

What it does

Represents a single URL segment.

How to use

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

Class Overview

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

Class Description

A UrlSegment is a part of a URL between the two slashes. It contains a path and the matrix parameters associated with the segment.

Constructor

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

Class Details

path : string

The part part of a URL segment.

parameters : {[key: string]: string}

The matrix parameters associated with a segment.

toString() : string

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

doc_Angular
2016-10-06 09:47:11
Comments
Leave a Comment

Please login to continue.