Last active
October 29, 2018 06:52
-
-
Save LironHazan/28bc8220e7bbc77e25621b364d5e156f to your computer and use it in GitHub Desktop.
for a medium post
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ngOnInit() { | |
this.themServiceSubscription = this.themService.observeActiveThemeChane() | |
.subscribe(themeName => { | |
this.themeName = themeName ; | |
this.updateTheme(this.themeName); | |
}); | |
} | |
updateTheme(themeName) { | |
const element = this.elementRef.nativeElement; | |
const them = themes[themeName]; | |
for (const key in them) { | |
element.style.setProperty(key, them[key]); | |
this.document.body.style.setProperty(key, them[key]); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment