From 9fa025262496627e4c1cd2187287607283e7b213 Mon Sep 17 00:00:00 2001 From: Cucumberrbob <128094686+Cucumberrbob@users.noreply.github.com> Date: Thu, 20 Mar 2025 15:48:51 +0000 Subject: [PATCH] fix: close mobile menu after navigating --- client/src/app/navbar/navbar.component.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/client/src/app/navbar/navbar.component.ts b/client/src/app/navbar/navbar.component.ts index 17530e3..58c905d 100644 --- a/client/src/app/navbar/navbar.component.ts +++ b/client/src/app/navbar/navbar.component.ts @@ -1,5 +1,5 @@ import { Component, OnInit } from '@angular/core'; -import { Router } from '@angular/router'; +import {NavigationEnd, Router} from '@angular/router'; import { AuthService } from '../auth.service'; import { Profile } from '../models/profile.model'; import { SettingsService } from '../settings.service'; @@ -20,7 +20,13 @@ export class NavbarComponent implements OnInit { private settingsService: SettingsService, private authService: AuthService, private router: Router, - ) {} + ) { + this.router.events.subscribe(event => { + if (event instanceof NavigationEnd) { + this.showMobileMenu = false; + } + }) + } ngOnInit(): void { this.settingsService.getProfile().subscribe((result) => {