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

Is there a property isOpen(or similar) for a directive <md-menu>in angular-materialthat could be listened to or linked to?


Note. My original question was much longer and overly complicated, but @Sarhanis made me realize that I was asking the wrong question.

+4
source share
3 answers

I was struggling with the same scenario, and when I tried my answer, I found out that $scope <md-menu>there is inside . $mdMenuIsOpen Therefore, using this will not require binding to the event.

+1
source

@Sarhanis , . Angular $mdMenuOpen, $mdMenuClose :

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

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

});
+3

.

jQuery Angular. DOM, jQuery , Angular .

HTML, ngClass. doco ngClass: https://docs.angularjs.org/api/ng/directive/ngClass

Showing and hiding elements should be done using ngShow or ngIf: https://docs.angularjs.org/api/ng/directive/ngShow https://docs.angularjs.org/api/ng/directive/ngIf

They should work with the scope variables that you defined in your controllers.

0
source

All Articles