How to use ngStyle to add background-image? My code doesn't work:
this.photo = 'http://dl27.fotosklad.org.ua/20121020/6d0d7b1596285466e8bb06114a88c903.jpg'; <div [ngStyle]="{'background-image': url(' + photo + ')}"></div>
I think you could try this:
<div [ngStyle]="{'background-image': 'url(' + photo + ')'}"></div>
From reading your ngStyle expression, I guess that you missed some "'"...
ngStyle
1.4m articles
1.4m replys
5 comments
57.0k users