Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 996
tao Avatar asked Feb 29 '16 00:02

tao


1 Answers

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); 

});
like image 173
tao Avatar answered Nov 02 '22 04:11

tao