Represents a single URL segment.
说明
A UrlSegment is a part of a URL between the two slashes. It contains a path and the matrix parameters associated with the segment.
Example
@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} } }构造函数
constructor(path: string, parameters: { [name: string]: string; })参数path | The path part of a URL segment | parameters | The matrix parameters associated with a segment |
|
属性
属性名 | 类型 | 说明 |
---|
path | | The path part of a URL segment 声明于构造函数中 |
parameters | | The matrix parameters associated with a segment 声明于构造函数中 |
parameterMap | | 只读 |
方法
|
---|
toString(): string参数没有参数。 返回值string
|