You can use ActivatedRoute interface, it contains the router state tree
within the angular app’s memory.
The parent property represents the parent of the route in the router state tree,
while the snapshot property is the current snapshot of the route and url is an
observable of the URL segments and it matched by this route.
Step 1: Import ActivatedRoute
    import { ActivatedRoute } from '@angular/router';
Step 2: Inject ActivatedRoute in constructor.
    constructor(private route: ActivatedRoute) { }
Step 3: Call it in Oninit lifecycle hook
      constructor(private route: ActivatedRoute){}
        
           ngOnInit() {
              this.route.parent.snapshot.url[2].path;
           }