1

I have the following URL: http://localhost:6002/S8R4oL_nDk8-/a0_ksrURM10-/inspections/list/(inspection:bulk-assign) and what I'm trying to do is to get the outlet name (bulk-assign) but I can't find an elegant solution for this.

I just found this one Get current named outlet from url but it's so ugly. Isn't there any other possibility to do that?

Sergiu Molnar
  • 865
  • 1
  • 11
  • 22

2 Answers2

0

Another solution that I've found is this.activatedRoute.snapshot.children[0].routeConfig.path.

Sergiu Molnar
  • 865
  • 1
  • 11
  • 22
0

It looks like the ActivatedRouteSnapshot contains a property called outlet, which seems to be what you're looking for:

export class ActivatedRouteSnapshot {
  /** @internal */
  constructor(
      /** The URL segments matched by this route */
      public url: UrlSegment[],
      /* ... */,
      /** The outlet name of the route */
      public outlet: string,
      /* ... */
      ) {}
  /* ... */
}

Source code.

Andrei Gătej
  • 11,116
  • 1
  • 14
  • 31