I have an attribute on an HTML element that I want to give a value based on a series of conditions.
For example, if article.fields.category==='Example One' I want to give my element the attribute am-icon with the value example-one. If however article.fields.category==='Another Example' it needs the value another-example and so on for a whole list.
I've tried this:
<i ng-attr-am-icon="{'example-one': article.fields.category==='Example One' || 'another-example': article.fields.category==='Another Example' || || 'third-example': article.fields.category==='Third Example'}"></i>
This does not apply the attribute and I'm pretty sure I'm writing it wrong. But I can't seem to find documentation on ngAttr or examples of how to do this.
The desired result would be one of the following, based on the condition met:
<i am-icon="example-one"></i>
<i am-icon="another-example"></i>
<i am-icon="third-example"></i>