My angular application for small devices has a working sidebar toggling feature, but I want the sidebar to close or hide when clicking anywhere on the page (i.e body).
.component.html
<nav class="sidebar sidebar-offcanvas active" id="sidebar">
<ul class="nav">
<li class="nav-item nav-profile">
<a href="javascript:;" class="nav-link">
<div class="nav-profile-image">
<img src="assets/images/bbbs2.png" alt="profile">
<span class="login-status online"></span>
<!--change to offline or busy as needed-->
</div>
<div class="nav-profile-text">
<span class="font-weight-bold mb-2" style="color: #00B5B8"></span>
</div>
</a>
</li>
<li class="nav-item" [ngClass]="{ 'active': dashboard.isActive }">
<a class="nav-link" routerLink="/dashboard" routerLinkActive #dashboard="routerLinkActive">
<span class="menu-title" style="color: #00B5B8">Dashboard</span>
<i class="mdi mdi-home menu-icon" style="color:#00B5B8"></i>
</a>
</li>
// --and some more sidebar tabs
I now aim to eliminate the sidebar when the class is not active.