I am creating a list using ng-repeat something like this
<div ng-repeat="file in files">
{{file.name}}
</div>
But for the last element alone I would like to have a class (<div class="last">test</div>) included to it. how can i achieve this using ng-repeat?
You can use
$lastvariable withinng-repeatdirective. Take a look at doc.You can do it like this:
Where
computeCssClassis function ofcontrollerwhich takes sole argument and returns'last'ornull.Or