npm run serve:ssr funktioniert und Hamburger Menu bug fix

This commit is contained in:
2026-01-06 22:36:14 +01:00
parent 43027a54f7
commit 4f8fd77f7d
21 changed files with 371 additions and 111 deletions

View File

@@ -1,5 +1,5 @@
import { CommonModule } from '@angular/common';
import { AfterViewInit, Component, HostListener } from '@angular/core';
import { CommonModule, isPlatformBrowser } from '@angular/common';
import { AfterViewInit, Component, HostListener, PLATFORM_ID, inject } from '@angular/core';
import { ActivatedRoute, NavigationEnd, Router, RouterOutlet } from '@angular/router';
import { initFlowbite } from 'flowbite';
import { filter } from 'rxjs/operators';
@@ -29,6 +29,8 @@ export class AppComponent implements AfterViewInit {
build = build;
title = 'bizmatch';
actualRoute = '';
private platformId = inject(PLATFORM_ID);
private isBrowser = isPlatformBrowser(this.platformId);
public constructor(
public loadingService: LoadingService,
@@ -48,9 +50,11 @@ export class AppComponent implements AfterViewInit {
this.actualRoute = currentRoute.snapshot.url[0].path;
// Re-initialize Flowbite after navigation to ensure all components are ready
setTimeout(() => {
initFlowbite();
}, 50);
if (this.isBrowser) {
setTimeout(() => {
initFlowbite();
}, 50);
}
});
}
ngOnInit() {
@@ -60,7 +64,9 @@ export class AppComponent implements AfterViewInit {
ngAfterViewInit() {
// Initialize Flowbite for dropdowns, modals, and other interactive components
// Note: Drawers work automatically with data-drawer-target attributes
initFlowbite();
if (this.isBrowser) {
initFlowbite();
}
}
@HostListener('window:keydown', ['$event'])