Commit 7b7ba46f by Torkel Ödegaard

fix(styleguide): fixed theme switching in style guide

parent 4f892ab9
...@@ -13,7 +13,7 @@ class StyleGuideCtrl { ...@@ -13,7 +13,7 @@ class StyleGuideCtrl {
pages = ['colors', 'buttons']; pages = ['colors', 'buttons'];
/** @ngInject **/ /** @ngInject **/
constructor(private $http, $routeParams) { constructor(private $http, private $routeParams, private $location) {
this.theme = config.bootData.user.lightTheme ? 'light': 'dark'; this.theme = config.bootData.user.lightTheme ? 'light': 'dark';
this.page = {}; this.page = {};
...@@ -37,8 +37,11 @@ class StyleGuideCtrl { ...@@ -37,8 +37,11 @@ class StyleGuideCtrl {
} }
switchTheme() { switchTheme() {
var other = this.theme === 'dark' ? 'light' : 'dark'; this.$routeParams.theme = this.theme === 'dark' ? 'light' : 'dark';
window.location.href = window.location.href + '?theme=' + other; this.$location.search(this.$routeParams);
setTimeout(() => {
window.location.href = window.location.href;
});
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment