2

I have tried the below code. But its not working.

    .coin:before{
       background-image:var(--dynamic-image);
     }

And I want to pass --dynamic-image from a method inside component. I am using Angular Renderer2 and the element that I want set background for is this.flip.

    flipCoin() {
      this.renderer.setStyle(this.flip.nativeElement, '--dynamic-image' , "url('https://www.w3schools.com/howto/img_forest.jpg')");
    }

Am I doing anything wrong here ??

Asridh Kumar
  • 515
  • 1
  • 6
  • 19

0 Answers0