Peter Boomsma
Peter Boomsma

Reputation: 9808

Close md-menu from controller

I have a md-menu item on my page and I want to be able to close it from a function in my controller.

I think the md-menu directive has a listener that can catch an event trough a broadcast but I can't find anything like that in the material design docs.

Something like this:

this.$rootScope.$broadcast('$mdCloseAllMenus);

This obviously doesn't work.

Upvotes: 0

Views: 330

Answers (1)

Adrian
Adrian

Reputation: 8597

Not aware of any listeners, however you should use the $mdMenu. Inject it into your controller. From there you should call

$mdMenu.hide(null, { closeAll: true });

Upvotes: 1

Related Questions