Last active
June 23, 2017 16:08
-
-
Save samlam/f487b2048a6968fc4f36dad7e137f031 to your computer and use it in GitHub Desktop.
Angular 4+ Renderer2 example
This file contains 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
import { Component,Renderer2 } from '@angular/core'; | |
@Component({ | |
selector:'app-root', | |
template:`` | |
}) | |
export class AppComponent{ | |
value=true; | |
constructor(private renderer:Renderer2){ | |
} | |
onChangeBackground(element:HTMLElement){ | |
this.renderer.setStyle(element,'background-color','blue'); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment