diff --git a/frontend/src/app/core/components/navbar/navbar.component.html b/frontend/src/app/core/components/navbar/navbar.component.html
index 3848b65..7502df3 100644
--- a/frontend/src/app/core/components/navbar/navbar.component.html
+++ b/frontend/src/app/core/components/navbar/navbar.component.html
@@ -1,6 +1,6 @@
+
\ No newline at end of file
diff --git a/frontend/src/app/core/components/navbar/navbar.component.ts b/frontend/src/app/core/components/navbar/navbar.component.ts
index 08bc3b5..b88d5ff 100644
--- a/frontend/src/app/core/components/navbar/navbar.component.ts
+++ b/frontend/src/app/core/components/navbar/navbar.component.ts
@@ -1,4 +1,4 @@
-import { Component } from '@angular/core';
+import { Component, ElementRef, HostListener } from '@angular/core';
import { ToggleService } from '../../services/toggle.service';
@Component({
@@ -9,7 +9,7 @@ import { ToggleService } from '../../services/toggle.service';
export class NavbarComponent {
showSearchPopup: boolean = false;
- constructor(private toggleService: ToggleService) {}
+ constructor(private toggleService: ToggleService, private eRef: ElementRef) {}
toggleSidebar() {
this.toggleService.toggleSidebar();
@@ -18,4 +18,18 @@ export class NavbarComponent {
toggleSearchPopup() {
this.showSearchPopup = !this.showSearchPopup;
}
+
+ closeSearchPopup() {
+ // if (this.showSearchPopup) this.showSearchPopup = !this.showSearchPopup;
+ }
+
+ @HostListener('document:click', ['$event'])
+ clickout(event: { target: any }) {
+ if (
+ !this.eRef.nativeElement.contains(event.target) &&
+ this.showSearchPopup
+ ) {
+ this.showSearchPopup = false;
+ }
+ }
}