I\'ve been implementing ng2-bootstrap and Angular2.
I cannot figure out how to make the mobile navbar open / close.
Is this something that just isn\'
While Seth's solution works absolutely fine as it is, I modified the collapsing logic. Instead of using the click event, I subscribe to the router events to collapse the menu only after successful navigation.
export class NavMenuComponent implements OnDestroy {
public isCollapsed: boolean = true;
private subscription: Subscription;
constructor(private router: Router) {
this.subscription = this.router.events.subscribe(s => {
if (s instanceof NavigationEnd) {
this.isCollapsed = true;
}
});
}
ngOnDestroy() {
this.subscription.unsubscribe();
}
}