I have a regular navbar on larger screens. I want to have a hamburger menu only on mobile devices and the menu icon only to be shown on mobile. I want to achieve that with Angular(I am beginner). How do I do that , don't want to use Angular material. Here is my code.
<div class="b-navbar">
<div class="b-navbar__toggle">
<button (click)="onToggle()" class="b-navbar__button">
<fa-icon [icon]="hamburgerBars" class="b-navbar__icon"></fa-icon>
</button>
</div>
<ul class="b-navbar__nav" *ngIf="showToggle">
<li class="b-navbar__nav">
<a routerLink="/home" class="b-navbar__link">Home</a>
</li>
<li class="b-navbar__nav">
<a class="b-navbar__link" href="#">Services</a>
</li>
<li class="b-navbar__nav">
<a routerLink="/about" class="b-navbar__link">About</a>
</li>
<li class="b-navbar__nav">
<a class="b-navbar__link" href="#">Reviews</a>
</li>
<li class="b-navbar__nav">
<a class="b-navbar__link" href="#">Locations</a>
</li>
<li class="b-navbar__nav">
<a routerLink="/contact" class="b-navbar__link">Contacts</a>
</li>
</ul>
</div>
Angular Code`
hamburgerBars = faBars;
onToggle() {
this.showToggle = !this.showToggle;
}
question from:
https://stackoverflow.com/questions/65862683/how-to-show-hamburger-menu-only-on-mobile-angular 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…