Skip to content

Instantly share code, notes, and snippets.

@LironHazan
Last active October 29, 2018 06:52
Show Gist options
  • Save LironHazan/28bc8220e7bbc77e25621b364d5e156f to your computer and use it in GitHub Desktop.
Save LironHazan/28bc8220e7bbc77e25621b364d5e156f to your computer and use it in GitHub Desktop.
for a medium post
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