ThinkChat🤖让你学习和工作更高效,注册即送10W Token,即刻开启你的AI之旅 广告
##UrlSegment 表示单个URL片段 ### 如何使用 ```typescript @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} } } ``` ### 类定义 ```typescript class UrlSegment { constructor(path: string, parameters: {[key: string]: string}) path : string parameters : {[key: string]: string} toString() : string } ``` ### 类描述 `UrlSegment`表示在一个 URL 的两个斜线(/)之间的内容。它包含了和片段关联的路径和矩阵参数信息。 ### 属性 - path : `string` URL片段的路径部分 - parameters : {[key: `string`]: `string`} 和片段关联的矩阵参数 - toString() : `string`