Angular 8 References/ Router


This is the documentation for Angular 8.
You can switch to the latest version Angular 10.

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.


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}