33 lines
807 B
TypeScript
33 lines
807 B
TypeScript
import { Component, OnInit } from '@angular/core';
|
|
import { ActivatedRoute } from '@angular/router';
|
|
import { Subject } from 'rxjs';
|
|
import { takeUntil } from 'rxjs/operators';
|
|
import { NavService } from '../nav/nav.service';
|
|
|
|
@Component({
|
|
selector: 'app-header',
|
|
templateUrl: './header.component.html',
|
|
styleUrls: ['./header.component.scss']
|
|
})
|
|
export class HeaderComponent implements OnInit {
|
|
_unsubscribe$: Subject<boolean> = new Subject();
|
|
|
|
pageTitle: string;
|
|
|
|
constructor(public navService: NavService) { }
|
|
|
|
ngOnInit(): void {
|
|
this.navService.currentPage$
|
|
.pipe(takeUntil(this._unsubscribe$))
|
|
.subscribe((page: string) => {
|
|
this.pageTitle = page;
|
|
});
|
|
}
|
|
|
|
ngOnDestroy(): void {
|
|
this._unsubscribe$.next(false);
|
|
this._unsubscribe$.complete();
|
|
}
|
|
|
|
}
|