I have made a directive for my sidenav. In my sidenav I have some elements that have submenu items under them. At the moment I can toggle only one element in the sidenav, but I need atleast 2-3 more. How should I implement it ?
My directive code:
menuItem.directive("menuItem", function() {
return {
restrict: "E",
template: "<div ng-click='toggle($event)' ng-transclude></div>",
transclude: true,
scope: {
hash: "@",
show: '=',
},
link: function($scope) {
$scope.toggle = function(e) {
$scope.show = !$scope.show;
}
}
}
});
My html code:
<menu visible="leftVisible" alignment="left">
<menu-item hash="first" show="someVar">
Side Menu item
<ul ng-show="someVar">
<li>
<a>First submenu item</a>
</li>
<li>
<a>First submenu item</a>
</li>
</ul>
</menu-item>
<menu-item hash="second" show="someVar">
Side Menu item
<ul ng-show="someVar">
<li>
<a >Second submenu item</a>
</li>
<li>
<a >Second submenu item</a>
</li>
</ul>
</menu-item>
<menu-item hash="third">Side Menu item</menu-item>
</menu>
My goal is that I can open submenus individually with ng-show in the sidenav, any ideas how to do it?