Skip to content

Commit

Permalink
fix(sideMenu): remove .menu-open on destroy
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
adamdbradley committed Aug 6, 2014
1 parent 44fee26 commit f246c5a
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion js/angular/directive/sideMenus.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
});

}
}
};
}]);

0 comments on commit f246c5a

Please sign in to comment.