Inuart
Inuart

Reputation: 1512

Callback on mdMenu close

Lets say I have an app that can open menus, for example via $mdOpenMenu($event).

My app needs to set a callback to get notified when a menu opens or closes.

How can I achieve it? I read the official documentation and I can't seem to find it.

I was looking for something like md-on-remove (used on mdChips), but it doesn't seem to be implemented for mdMenu (issue).

Upvotes: 8

Views: 4833

Answers (2)

user2136053
user2136053

Reputation:

This works for me:

ng-click="$mdOpenMenu(); AppCtrl.closeMdMenu();"

AppCtrl

vm.closeMdMenu = function() { $mdMenu.hide(); };

Upvotes: 1

Inuart
Inuart

Reputation: 1512

$scope.$on("$mdMenuClose", function() { console.log("menu closing") });

Upvotes: 15

Related Questions