]> git.evergreen-ils.org Git - Evergreen.git/blob - Open-ILS/src/eg2/src/app/staff/cat/vandelay/vandelay.component.ts
LP2042879 Shelving Location Groups Admin accessibility
[Evergreen.git] / Open-ILS / src / eg2 / src / app / staff / cat / vandelay / vandelay.component.ts
1 import {Component} from '@angular/core';
2 import {Router, ActivatedRoute, NavigationEnd} from '@angular/router';
3 import {take} from 'rxjs/operators';
4 import {VandelayService} from './vandelay.service';
5
6 @Component({
7     templateUrl: 'vandelay.component.html'
8 })
9 export class VandelayComponent {
10     tab: string;
11
12     constructor(
13         private router: Router,
14         private route: ActivatedRoute,
15         private vandelay: VandelayService) {
16
17         // As the parent component of the vandelay route tree, our
18         // activated route never changes.  Instead, listen for global
19         // route events, then ask for the first segement of the first
20         // child, which will be the tab name.
21         this.router.events.subscribe(routeEvent => {
22             if (routeEvent instanceof NavigationEnd) {
23                 this.route.firstChild.url.pipe(take(1))
24                     // eslint-disable-next-line rxjs/no-nested-subscribe
25                     .subscribe(segments => this.tab = segments[0].path);
26             }
27         });
28     }
29 }
30