I'm struggling to incorporate a background url style based on a given condition. I tried using data-ng-style, but for some unknown reason, it's not working as expected. I'm not sure where I'm going wrong.
data-ng-style="true : {'background-image': 'url(' + getThumbnailUrl(item) + ')'}, false : {}[item.thumbnailClass === undefined]"
In essence, I want to set the background image using data-ng-style if thumbnailClass is undefined; otherwise, I want to leave it unchanged.
You can check out my code in this JSFiddle: http://jsfiddle.net/Lvc0u55v/5666/. In this example, we can consider 'fafa' to be a boolean – apply the style when true and do nothing when false.
Any ideas on how to achieve this in AngularJS? Thank you.