I'm struggling to add additional background
styles using ng-style
. The idea of what I am trying to do is make a grid of speakers using ng-repeat
, each grid element having it's own image of a speaker. This is fine, except that I want the images to be a background
, and while I can successfully get the image to reflect I can't add the css for background-position
& background-size
. The basics of what I am doing is here, but the issue is I've tried using inline styles unsuccessfully:
CODE:
<div class="grid" ng-repeat="speaker in home.speakers">
<div class="grid-image" ng-style="{'background':'url({{speaker.img}})' 'center center' '/' 'cover'}"></div>
<span class="caption"><h3>{{speaker.name}}</h3></span>
</div>
I've played with the single quotes every imaginable way, but still get the console error that it has no idea what I am trying to do. I've also tried just setting background size
and background position
in a separate class, but this doesn't work because the image isn't declared with it. I really am at a loss here, though I would assume I wouldn't be the first to try this, I'm just finding nothing helpful on it.