From e66192172a9f19820f3617933412f7edb4d2374e Mon Sep 17 00:00:00 2001 From: "konstantina.galouni" Date: Tue, 10 Sep 2024 02:07:04 +0300 Subject: [PATCH] [develop | DONE | FIXED]: navigationBar.component.ts: Added a class field public isClient: boolean = false; and set it in constructor with "this.isClient = !isPlatformServer(this.platform);" statement | navigationBar.component.html: Added checks not to display dropdowns on server (needed also for non destructive hydration). --- sharedComponents/navigationBar.component.html | 4 ++-- sharedComponents/navigationBar.component.ts | 11 ++++++++--- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/sharedComponents/navigationBar.component.html b/sharedComponents/navigationBar.component.html index a0147369..8b90121a 100644 --- a/sharedComponents/navigationBar.component.html +++ b/sharedComponents/navigationBar.component.html @@ -220,7 +220,7 @@ {{menu.badge}} {{menu.title}} -
+
    @@ -272,7 +272,7 @@ {{menu.title}} -
      diff --git a/sharedComponents/navigationBar.component.ts b/sharedComponents/navigationBar.component.ts index bffc64f1..a0657c2b 100644 --- a/sharedComponents/navigationBar.component.ts +++ b/sharedComponents/navigationBar.component.ts @@ -1,10 +1,10 @@ import { ChangeDetectorRef, - Component, ElementRef, + Component, ElementRef, Inject, Input, OnChanges, OnDestroy, - OnInit, QueryList, + OnInit, PLATFORM_ID, SimpleChanges, ViewChild, ViewChildren } from '@angular/core'; @@ -21,6 +21,7 @@ import {NotificationConfiguration} from "../notifications/notifications-sidebar/ import {SearchInputComponent} from "./search-input/search-input.component"; import {Filter} from "../searchPages/searchUtils/searchHelperClasses.class"; import {RouterHelper} from "../utils/routerHelper.class"; +import {isPlatformServer} from "@angular/common"; declare var UIkit; @@ -97,12 +98,16 @@ export class NavigationBarComponent implements OnInit, OnDestroy, OnChanges { @ViewChild('canvas') canvas: ElementRef; public routerHelper: RouterHelper = new RouterHelper(); + public isClient: boolean = false; constructor(private router: Router, private route: ActivatedRoute, private config: ConfigurationService, private _helpContentService: HelpContentService, private layoutService: LayoutService, - private cdr: ChangeDetectorRef) {} + private cdr: ChangeDetectorRef, + @Inject(PLATFORM_ID) private platform: any) { + this.isClient = !isPlatformServer(this.platform); + } ngOnInit() { this.subs.push(this.route.queryParams.subscribe(params => {