I want to set an title attribute if a certain a condition is true. If content is avaiblabe I want to set a class and the alt text. How can I set the title text?
HTML
<li ng-class="{true: 'my_class', false: ''}[content]" title="this is content">
I want to set an title attribute if a certain a condition is true. If content is avaiblabe I want to set a class and the alt text. How can I set the title text?
HTML
<li ng-class="{true: 'my_class', false: ''}[content]" title="this is content">
You can use same technique as you used for the ng-class:
<li ng-class="{true: 'my_class', false: ''}[content]" title="{{{true: 'title true', false: 'title false'}[content]}}">
Use an expression like this {{ condition && if_true || if_false }}
. Example:
<li ng-class="{ 'my_class': !!content }" title="{{ !!content && content || otherContent }}">