From 7b7ba46f123cff0517d110594f045bc6727a101d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Wed, 21 Sep 2016 09:10:25 +0200 Subject: [PATCH] fix(styleguide): fixed theme switching in style guide --- public/app/features/styleguide/styleguide.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/public/app/features/styleguide/styleguide.ts b/public/app/features/styleguide/styleguide.ts index 52ccd20ac59..c297f12ab4c 100644 --- a/public/app/features/styleguide/styleguide.ts +++ b/public/app/features/styleguide/styleguide.ts @@ -13,7 +13,7 @@ class StyleGuideCtrl { pages = ['colors', 'buttons']; /** @ngInject **/ - constructor(private $http, $routeParams) { + constructor(private $http, private $routeParams, private $location) { this.theme = config.bootData.user.lightTheme ? 'light': 'dark'; this.page = {}; @@ -37,8 +37,11 @@ class StyleGuideCtrl { } switchTheme() { - var other = this.theme === 'dark' ? 'light' : 'dark'; - window.location.href = window.location.href + '?theme=' + other; + this.$routeParams.theme = this.theme === 'dark' ? 'light' : 'dark'; + this.$location.search(this.$routeParams); + setTimeout(() => { + window.location.href = window.location.href; + }); } }