Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AngularJS - Set title attribute

Tags:

angularjs

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">  
like image 467
user1477955 Avatar asked Sep 29 '14 09:09

user1477955


1 Answers

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]}}">

http://plnkr.co/edit/IdBxje8PUMPEK3MnenXt?p=preview

like image 86
Marian Ban Avatar answered Nov 03 '22 00:11

Marian Ban