I use Angular Material menarar to display the menu and submenu under each menu item. I added the ng-click event to open the submenu. But the menu still opens when you hover over the parent menu item. Not only that, since I have two submenus for the first element of the submenu, the submenu opens when you hover, but the second submenu does not open when you hover. How can I stop this hovering menu open. I tried to stop the event propagation in mouseenter in the parent element. But then during the opening of the second submenu, the first submenu is not hidden. Please help me how to fix this.
<div ng-controller="DemoBasicCtrl as ctrl" ng-cloak="" class="menuBardemoBasicUsage" ng-app="MyApp"> <md-menu-bar> <md-menu> <button ng-click="$mdOpenMenu()"> File </button> <md-menu-content> <md-menu-item> <md-menu> <md-button ng-click="$mdOpenMenu()">New</md-button> <md-menu-content> <md-menu-item><md-button ng-click="ctrl.sampleAction('New Document', $event)">Document</md-button></md-menu-item> </md-menu-content> </md-menu> </md-menu-item> <md-menu-item> <md-menu> <md-button ng-click="$mdOpenMenu()">New</md-button> <md-menu-content> <md-menu-item><md-button ng-click="ctrl.sampleAction('New Document', $event)">Document</md-button></md-menu-item> </md-menu-content> </md-menu> </md-menu-item> </md-menu-content> </md-menu> </md-menu-bar>
My existing demo code is in the demo .
angularjs angular-material submenu menubar
Indra
source share