md-menus not closing when using ng-repeat
<md-menu-bar>
<md-menu ng-repeat="section in sections">
<md-button class="navButton" ng-click="$mdOpenMenu()">
{{section.name}}
</md-button>
<md-menu-content>
<md-menu-item>
<md-button>Subsection 1</md-button>
</md-menu-item>
</md-menu-content>
</md-menu>
</md-menu-bar>
I am doing something like above but unfortunately, if I click a menu, it stays open even if I click other buttons.
I just want it to have the same behavior as
https://material.angularjs.org/latest/demo/menuBar
P.S. If I don't use ng-repeat (meaning, menus are static), it works fine though.
Any ideas how I could fix this? I will try to setup a plunker for this one.
You can inject $mdMenu on your controller and use $mdMenu.hide(); by the end of the function called by the item of the menu.
+1
Duplicate of #4484 ... but would be nice to have an interim solution as this is rather frustrating.