Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
import { Directive, ElementRef, Renderer } from '@angular/core';
selector: '[appChbgcolor]'
export class ChangeBgColorDirective {
constructor(private el: ElementRef, private renderer: Renderer) {
ChangeBgColor(color: string) {
this.renderer.setElementStyle(this.el.nativeElement, 'color', color);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment