I am trying to programmatically change the background image in angular.
this.document.getElementsByClassName("modal-header email-header")[0].style= 'background-image=""
It does not seem to work.
I am trying to programmatically change the background image in angular.
this.document.getElementsByClassName("modal-header email-header")[0].style= 'background-image=""
It does not seem to work.
 
    
    In angular we use variables in .ts and bind the variables in the .html. So you can declare a variable in your .ts
background:string="assets/img.jpg"
And in .html
   <div class=""modal-header email-header" 
      [style.background-image]="background">
When in .ts you change the variable (I imagine in a function or in an event)
   this.background=null; //in any place
The "style.background-image" change in .html
NOTE: Instead use [style.background-image], you can also use [ngStyle] or [ngClass]
NOTE2: I always suggest make a tour of Heroes when we start with Angular or beings with Getting started with Angular
