Andrei Gheorghiu Andrei Gheorghiu - 6 months ago 37
Javascript Question

Is there an isOpen property of <md-menu> directive?

Is there an

isOpen
property (or similar) for the
<md-menu>
directive in
angular-material
that one could listen or bind to?




Note: My initial question was a lot longer and overly complicated but @Sarhanis made me realize I was asking the wrong question.

Answer

Thanks to @Sarhanis, I was able to find out how to bind actions to menu opening and closing events. On opening and closing menus, Angular Material broadcasts $mdMenuOpen, respectively $mdMenuClose events:

$scope.$on('$mdMenuOpen', function(event, menu) { 
    console.log('opening menu...', event, menu); 

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

});
Comments