I am setting up a background in a div tag that is a font awesome icon in each row of a table. This icon depends on the object that is being displayed. I tried setting up the code similar to Changing CSS content property dynamically. However, my data-content would be a unicode. I am assigning the values in an angular controller as follows:
if (type) {
if (type.image.includes('fa-hand-o-up')) {
type.background = '\f0a6';
} else if (type.image.includes('fa-wrench')) {
type.background = '\f0ad';
} else if (type.image.includes('fa-star')) {
type.background = '\f005';
}
return type;
}
and then including them in the table as follows:
<td>
<div class="text-center type-wrapper"
data-content="{{::dataItem.type.background}}">
<span class="bold">{{::dataItem.type.name}}</span>
</div>
</td>
However, this just puts 0a6, 0ad, and 005 as the background 'image'. Is there a way to add unicode content dynamically or is the attr(data-xxx) just for plain text?
Also, I tried adding a attr(data-color) for color, but that doesn't seem to work either. Is that also because I am using hex code instead of plain text?