Skip to content

Commit 7b7ba46

Browse files
committed
fix(styleguide): fixed theme switching in style guide
1 parent 4f892ab commit 7b7ba46

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

public/app/features/styleguide/styleguide.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class StyleGuideCtrl {
1313
pages = ['colors', 'buttons'];
1414

1515
/** @ngInject **/
16-
constructor(private $http, $routeParams) {
16+
constructor(private $http, private $routeParams, private $location) {
1717
this.theme = config.bootData.user.lightTheme ? 'light': 'dark';
1818
this.page = {};
1919

@@ -37,8 +37,11 @@ class StyleGuideCtrl {
3737
}
3838

3939
switchTheme() {
40-
var other = this.theme === 'dark' ? 'light' : 'dark';
41-
window.location.href = window.location.href + '?theme=' + other;
40+
this.$routeParams.theme = this.theme === 'dark' ? 'light' : 'dark';
41+
this.$location.search(this.$routeParams);
42+
setTimeout(() => {
43+
window.location.href = window.location.href;
44+
});
4245
}
4346

4447
}

0 commit comments

Comments
 (0)