Skip to content

Commit f246c5a

Browse files
committed
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.
1 parent 44fee26 commit f246c5a

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

js/angular/directive/sideMenus.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,19 @@ IonicModule
5757
* with {@link ionic.service:$ionicSideMenuDelegate}.
5858
*
5959
*/
60-
.directive('ionSideMenus', [function() {
60+
.directive('ionSideMenus', ['$document', function($document) {
6161
return {
6262
restrict: 'ECA',
6363
controller: '$ionicSideMenus',
6464
compile: function(element, attr) {
6565
attr.$set('class', (attr['class'] || '') + ' view');
66+
67+
return function($scope) {
68+
$scope.$on('$destroy', function(){
69+
$document[0].body.classList.remove('menu-open');
70+
});
71+
72+
}
6673
}
6774
};
6875
}]);

0 commit comments

Comments
 (0)