nobitagit / ng-material-floating-button

Material design floating menu with action buttons implemented as an Angularjs directive.
http://nobitagit.github.io/ng-material-floating-button/
MIT License
464 stars 130 forks source link

Click Toggle close on location change #67

Closed stephenycchang closed 8 years ago

stephenycchang commented 8 years ago

What is the best way to close the button on location change.

Currently using ngRoute and the menu-state on the button.

I tried the code: $rootScope.$on('$locationChangeStart', function(){ $rootScope.closeFab = 'closed'; )}

And the button I'm using is something like: <span mfb-menu position="br" toggling-method="click" active-icon="mdi mdi-close" resting-icon="mdi mdi-cloud-upload" effect="slidein" menu-state="closeFab">

But it seems like the menu-state is expecting a $scope only and will not work with $rootScope.

If I set it on the $scope on the current controller, it works, just not with $rootScope.

I have a dirty alternative right now with jQuery where I do an attr('data-mfb-state','closed') but it's buggy.

Is there anything I'm doing wrong?

Thanks!