我想显示/隐藏侧边栏,但是两者都在不同的组件中,我在其他组件中使用侧边栏和导航栏选择器来显示侧边栏和导航栏。
// navbar html
<nav class="navbar navbar-expand-lg ">
<div class="container-fluid">
<button class="navbar-toggler navbar-toggler-right" type="button" data-toggle="collapse"
aria-controls="navigation-index" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-bar burger-lines"></span>
<span class="navbar-toggler-bar burger-lines"></span>
<span class="navbar-toggler-bar burger-lines"></span>
</button>
<div class="ml-auto">
<a href="#" class="text-secondary">
<button type="button" class="btn btn-primary">Logout</button>
</a>
</div>
</div>
//侧边栏html
<div class="sidebar">
<div class="logo">
<a class="simple-text logo-normal">
Sidebar
</a>
</div>
<div class="sidebar-wrapper">
<ul class="nav">
<li class="nav-item " [routerLink]="['/dashboard']" routerLinkActive="active">
<a class="nav-link">
<p>Dashboard</p>
</a>
</li>
</ul>
</div>