Reputation: 185
I'm having some issues with ng-style
. Here's the code I have at the moment
ng-style="{'background-image': 'url(http://s3-us-west-1.amazonaws.com/'+ event.image2)'}"
The above isn't working, (I have had to remove the bucket name for reasons), but the code works if I have it like this:
ng-style="{'background': 'orange'}"
This is displaying fine. Why is the URL method not working?
Upvotes: 0
Views: 273
Reputation: 104
I guess event is a variable in your scope, in that case it's just a small typo:
ng-style="{'background-image': 'url(http://s3-us-west-1.amazonaws.com/' + event.image2 + ')'}"
Upvotes: 0
Reputation: 25797
You can write like this instead on the element:
<div style="background-image: url('http://s3-us-west-1.amazonaws.com/{{event.image2}}')"></div>
Upvotes: 1