AngularJS directive toggle menu preventing default for other directive
So I made a directive for a toggle (drop down) menu in AngularJS. I used the directive for multiple items within the page but I have a small problem. When one item is open and I click another one I want the previous one to close. The event.preventDefault and event.stopPropagation stops the event for the previous item and doesn't close it. Any ideas on how to fix this? Is there a way to perhaps only stop the event within the scope? app.directive('toggleMenu', function ($document) { return { restrict: 'CA', link: function (scope, element, attrs) { var opened = false; var button = (attrs