npm run serve:ssr funktioniert und Hamburger Menu bug fix
This commit is contained in:
@@ -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'])
|
||||
|
||||
Reference in New Issue
Block a user