I have prepared a Plunkr that provides the code:
I have assigned the object $scope.menu.show in controller toolbarCtrl that controls whether the menu is created or not.
<md-menu id="menu" ng-controller="toolbarCtrl" ng-if="true"> ...
The way that data generally should be shared through controllers is by using a service. Because you need both controllers to watch the same state, you can use Angular's events, specifically the
Here is an article that will walk you through having multiple controllers watch the same state:
Edit: After looking through this article some more, I realized it's not the best explanation, and there are some things in the code that don't work. For example, if you try to pass arguments in with a
$broadcast call, the
$on function needs two paramaters–event and args.