问题描述:

I have an HTML Code like below:

<div>

<div class="a"></div>

<div class="a"></div>

<div class="a"></div>

<div>

I want to add class "b" to the last child of the block using angularJS. Please note that I don't have the code as an static block and it made using a DataList and

<div class="a"></div>

is as a template so I only can change when created.

In jQuery I can easily use nth-child and addclass. I saw some sample in angularjs that use $index but here I don't have an ng-repeat so I cannot use it.

相关阅读:
Top