Reputation: 869
Is it possible to use the $index of ng-repeat in the class name?
Example:
ng-class="{'hand-' + $index: true}"
Thank you!
Upvotes: 10
Views: 4077
Reputation: 1241
You can use within html class:
class="list-{{$index}}"
for Angular use:
ng-class="['hand-' + $index]"
Upvotes: 1
Reputation: 30088
You can use it like this:
ng-class="['hand-' + $index]"
Additionally, you can use the class attribute to interpolate the class value
class="hand-{{$index}}"
Upvotes: 16