Angular won't load background image when added in HTML Style -
i have image path <div>{{image}}</div> gives:
<div>http://my_ip/images/file.jpg</div> but when add in html style background, doesn't load!
<div style="background-image: url('{{image}}')"></div> gives
<div style></div> any idea what's going on here? why isn't angular rendering image background image?
edit: i'm using angular 4.
use directive binding syntax
[ngstyle]="{'background-image': 'url('+backgroundurl+')'}" where background url link url address. documented here https://angular.io/api/common/ngstyle
Comments
Post a Comment