fix(sideMenu): remove .menu-open on destroy

If a menu was opened when navigating to a different view, it is
possible that the `menu-open` class was left on the body tag, which
disables the elements on the next side menu view. On side menu destroy,
ensure menu-open was removed from the body class.
This commit is contained in:
Adam Bradley
2014-08-06 15:24:31 -05:00
parent 44fee26436
commit f246c5aa20

View File

@@ -57,12 +57,19 @@ IonicModule
* with {@link ionic.service:$ionicSideMenuDelegate}.
*
*/
.directive('ionSideMenus', [function() {
.directive('ionSideMenus', ['$document', function($document) {
return {
restrict: 'ECA',
controller: '$ionicSideMenus',
compile: function(element, attr) {
attr.$set('class', (attr['class'] || '') + ' view');
return function($scope) {
$scope.$on('$destroy', function(){
$document[0].body.classList.remove('menu-open');
});
}
}
};
}]);