0

I need to add a background image in a span tag. The name of image is coming from Database. The code I had written is :

<span *ngIf="isSa === false" style ="background:url(assets/images/profile/{{emp_image}} ) no-repeat center"> </span>

The variable 'emp_image' is having a value '1.png' and it is getting if i am printing it outside the style.

  • 1
    Possible duplicate of [How to add background-image using ngStyle (angular2)?](https://stackoverflow.com/questions/34875426/how-to-add-background-image-using-ngstyle-angular2) – Akber Iqbal Jan 14 '19 at 12:27
  • 1
    check https://stackblitz.com/edit/angular-tzxvzf for working example – Akber Iqbal Jan 14 '19 at 12:30

0 Answers0