Skip to content
This repository was archived by the owner on Sep 5, 2024. It is now read-only.

Commit 035626b

Browse files
devversionThomasBurleson
authored andcommitted
fix(sidenav): apply theming on sidenav correctly
- The current theming of the sidenav wasn't working, because theming wasn't initialized on the element. - Backdrop should only inherit the theme if there is a parent (just a performance improvement - remove end-less non-sense watcher) Fixes #7084 Closes #7374
1 parent a8b886a commit 035626b

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

src/components/backdrop/backdrop.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,10 @@ angular
6060
}
6161
}
6262

63-
$mdTheming.inherit(element, element.parent());
63+
// Only inherit the parent if the backdrop has a parent.
64+
if (element.parent().length) {
65+
$mdTheming.inherit(element, element.parent());
66+
}
6467
});
6568

6669
}

src/components/sidenav/sidenav.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,10 @@ function SidenavDirective($mdMedia, $mdUtil, $mdConstant, $mdTheming, $animate,
242242
};
243243
var backdrop = $mdUtil.createBackdrop(scope, "md-sidenav-backdrop md-opaque ng-enter");
244244

245+
$mdTheming(element);
246+
247+
// The backdrop should inherit the sidenavs theme,
248+
// because the backdrop will take its parent theme by default.
245249
$mdTheming.inherit(backdrop, element);
246250

247251
element.on('$destroy', function() {

0 commit comments

Comments
 (0)