material icon indicating copy to clipboard operation
material copied to clipboard

md-menu 'is-open' state attribute

Open PezzerDev opened this issue 11 years ago • 5 comments

It would be great to have a reference to the state of an md-menu. This could be accomplished through an md-is-open attribute similar to that of md-sidenav. It would provide something like this:

<md-menu md-is-open="menuIsOpen">
    <md-button ng-class=" { 'some-class': menuIsOpen }">
        Button styled differently when menu is open
    </md-button>
    ...
</md-menu>

PezzerDev avatar Oct 05 '15 13:10 PezzerDev

@SpenceDiNicolantonio you can subscribe for $mdMenuOpen event and $mdMenuClose as a temporary solution for now.

    $scope.$on('$mdMenuClose', function(ev, element) {
    });

    $scope.$on('$mdMenuOpen', function(ev, element) {
    });

romanchak avatar Jan 25 '16 10:01 romanchak

@SpenceDiNicolantonio In your template you can use $mdMenuIsOpen which will be set to true if open / undefined if closed

stormcrow85 avatar Apr 04 '16 19:04 stormcrow85

You can also tap into the upper level class that is added

._md-open

ghost avatar Apr 27 '16 14:04 ghost

This issue is closed as part of our deprecation effort. For details, see our post Spring Cleaning 2016.

ThomasBurleson avatar Apr 28 '16 20:04 ThomasBurleson

@SpenceDiNicolantonio you can subscribe for $mdMenuOpen event and $mdMenuClose as a temporary solution for now.

    $scope.$on('$mdMenuClose', function(ev, element) {
    });

    $scope.$on('$mdMenuOpen', function(ev, element) {
    });

Thanks. That helped

ForkInSpace avatar Mar 22 '19 17:03 ForkInSpace