title: How can i change the background-image from Typescript in Angular?
body: <p>i want to change the background-image from the Typescript file in Agular, i tried but don't work.</p>
  
  <p>I change the style directly in my html file because i don't know how to do in the css.</p>
  
  <p>This is the line in my html file:</p>
  
  <pre><code>&lt;div style="background-image: url({{imageName}});"&gt; &lt;/div&gt;
  </code></pre>
  
  <p>and this is my Typescript file:</p>
  
  <pre><code>export class NAmeComponent implements OnInit {
  
    imageName: String;
  
  ngOninit(){
  this.getImage();
  }
  
  getImage(){
   switch (value) {
        case 'a': {
          this.imageName = 'Nebula.jpg';
          break;
        }
       case 'b': {
          this.imageName = 'Eclipse.jpeg';
          break;
        }
      }
  }
  }
  </code></pre>
  
  <p>How can i fix this? Thank all for the answer!</p>