当前位置: 动力学知识库 > 问答 > 编程问答 >

javascript - Nth-child in AngularJS

问题描述:

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.

分享给朋友:
您可能感兴趣的文章:
随机阅读: