show current link & bugfix
This commit is contained in:
parent
2a1f01ccfb
commit
7c95a43603
3 changed files with 32 additions and 8 deletions
|
|
@ -38,5 +38,9 @@ export class HeaderComponent {
|
|||
) {
|
||||
this.navbarLanguageVisible = false;
|
||||
}
|
||||
if (targetElement.closest('.link')) {
|
||||
this.navbarVisible = false;
|
||||
this.navbarLanguageVisible = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,9 +1,21 @@
|
|||
@if (navbarVisible) {
|
||||
<nav class="navbar d-none">
|
||||
<div class="link" routerLink="privacy-policy">
|
||||
<div
|
||||
class="link"
|
||||
routerLink="privacy-policy"
|
||||
[ngClass]="{
|
||||
active: currentRoute === '/privacy-policy'
|
||||
}"
|
||||
>
|
||||
<span>{{ "navbar.privacyPolicy" | translate }}</span>
|
||||
</div>
|
||||
<div class="link" routerLink="imprint">
|
||||
<div
|
||||
class="link"
|
||||
routerLink="imprint"
|
||||
[ngClass]="{
|
||||
active: currentRoute === '/imprint'
|
||||
}"
|
||||
>
|
||||
<span>{{ "navbar.legalNotice" | translate }}</span>
|
||||
</div>
|
||||
<div class="link" onclick="logout()">
|
||||
|
|
@ -14,21 +26,23 @@
|
|||
<nav class="navbar language d-none">
|
||||
<div
|
||||
class="link"
|
||||
(click)="langService.switchLanguage('en')"
|
||||
[ngClass]="{
|
||||
active: langService.currentLang === 'en'
|
||||
}"
|
||||
>
|
||||
<span>{{ "navbar.english" | translate }}</span>
|
||||
<span (click)="langService.switchLanguage('en')">{{
|
||||
"navbar.english" | translate
|
||||
}}</span>
|
||||
</div>
|
||||
<div
|
||||
class="link"
|
||||
(click)="langService.switchLanguage('de')"
|
||||
[ngClass]="{
|
||||
active: langService.currentLang === 'de'
|
||||
}"
|
||||
>
|
||||
<span>{{ "navbar.german" | translate }}</span>
|
||||
<span (click)="langService.switchLanguage('de')">{{
|
||||
"navbar.german" | translate
|
||||
}}</span>
|
||||
</div>
|
||||
</nav>
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { Component, Input } from '@angular/core';
|
||||
import { RouterModule } from '@angular/router';
|
||||
import { Router, RouterModule } from '@angular/router';
|
||||
import { HeaderComponent } from '../header/header.component';
|
||||
import { LanguageService } from '../../../services/language.service';
|
||||
import { CommonModule } from '@angular/common';
|
||||
|
|
@ -16,5 +16,11 @@ export class NavbarComponent {
|
|||
@Input() navbarVisible: boolean = false;
|
||||
@Input() navbarLanguageVisible: boolean = false;
|
||||
|
||||
constructor(public langService: LanguageService) {}
|
||||
currentRoute: string = '';
|
||||
|
||||
constructor(public langService: LanguageService, private router: Router) {}
|
||||
|
||||
ngOnInit() {
|
||||
this.currentRoute = this.router.url;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue