In this example: https://plnkr.co/edit/O9fbLcTV7QPvqB3FpiAA?p=preview
When you click the hamburger menu icon and select a nav item, it leaves the menu open until you click the hamburger icon again. Is there a good way to automatically collapse when a menu item is selected?
I tried:
<li><a href="#" ng-click="isNavCollapsed = !isNavCollapsed;">Link 1</a></li>
Which works, but will trigger the nav menu collapse animation when not in mobile mode (on a wider screen).
You can add an event listener using plain JS, where you can check that the width of the window matches your mobile breakpoint. Just make sure you wrap the actual change to the scope variable in a
$applyfunction otherwise AngularJS will not know about it:https://plnkr.co/edit/ZzbXZ3lFxqX6Tlra46W5?p=preview
Note that this will require you to keep your CSS and JS in sync with regards to the breakpoint value