I have a String variable that holds a reference to an icon, which I want to bind in the HTML to show it, as an attribute selector.
Code Snippet
.html
<thumbnail {{ obj.getIcon() }}> </thumbnail>
.ts
getIcon() {
return "icon-obj" + this.id;
}
Output
<thumbnail "icon-obj1"> </thumbnail>
Desired Output
<thumbnail icon-obj1> </thumbnail>
Known & Undesired alternative solution
<thumbnail class={{ obj.getIcon() }} > </thumbnail>
Basically, the string quotes are screwing everything. It works if I use a different type of selector, like I showed in the example above that outputs to class="icon-obj1"
, but that's not the point.
So, any suggestion? Thanks for reading!