diff --git a/src/app/gui/navbar/navbar.component.html b/src/app/gui/navbar/navbar.component.html index c97fd64..693aa7e 100644 --- a/src/app/gui/navbar/navbar.component.html +++ b/src/app/gui/navbar/navbar.component.html @@ -7,14 +7,14 @@ [href]="link.address" [target]="link.newtab === undefined || link.newtab === true ? '_blank' : '_self'" rel="noopener" - [class.forcefocus] = "(currentDocument.onDocumentChange() | async)?.id == link.address" + [class.forcefocus] = "currentDocument?.id == link.address" >{{link.text}} {{link.text}} diff --git a/src/app/gui/navbar/navbar.component.ts b/src/app/gui/navbar/navbar.component.ts index 66f71eb..bc12ec3 100644 --- a/src/app/gui/navbar/navbar.component.ts +++ b/src/app/gui/navbar/navbar.component.ts @@ -4,6 +4,8 @@ import { ActivatedRoute, UrlSegment } from "@angular/router"; import { map } from "rxjs/operators"; import { CurrentDocumentService } from "src/app/services/current-document.service"; import { navigationLinks } from "src/app/app-routing.module"; +import { DocumentData } from "src/app/symbols/DocumentData"; +import { Observable } from "rxjs"; @Component({ selector: "app-navbar", @@ -18,8 +20,13 @@ export class NavbarComponent implements OnInit, AfterViewInit { overflowMax = false; @ViewChild("navlogo") navLogo: ElementRef; @ViewChild("navbuttons") navButtons: ElementRef; + currentDocument: DocumentData; - constructor(private elRef: ElementRef, public currentDocument: CurrentDocumentService) { } + constructor(private elRef: ElementRef, currentDocument: CurrentDocumentService) { + currentDocument.onDocumentChange().subscribe(docData => { + this.currentDocument = docData; + }); + } ngOnInit() { }