http://stackoverflow.com/questions/7792652/what-is-the-best-way-to-conditionally-apply-a-class-with-angularjs ng-class="{selected: $index==selectedIndex}" ng-class="($index==selectedIndex) ? 'selected' : ''"