亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

angular.js - ngrepeat adds attributes to specified content
phpcn_u1582
phpcn_u1582 2017-05-15 16:54:31
0
3
770
    <p ng-repeat="program in programs">
        <a class="pBlock" href="#"></a>
    </p>

There are 10 pieces of data in programs. Now I want to add a specific attribute command rightCtrl
to the a tag of the 5th and 10th items to achieve the following effect

    <p><a class="pBlock" href="#"></a></p>
    <p><a class="pBlock" href="#"></a></p>
    <p><a class="pBlock" href="#"></a></p>
    <p><a class="pBlock" href="#"></a></p>
    <p><a class="pBlock" href="#" rightCtrl></a></p>
    <p><a class="pBlock" href="#"></a></p>
    <p><a class="pBlock" href="#"></a></p>
    <p><a class="pBlock" href="#"></a></p>
    <p><a class="pBlock" href="#"></a></p>
    <p><a class="pBlock" href="#" rightCtrl></a></p>

How to achieve this

phpcn_u1582
phpcn_u1582

reply all(3)
淡淡煙草味

ng-repeat指令會(huì)遍歷programs集合,然后給集合中的每一個(gè)元素都生成一個(gè)模板實(shí)例,集合programs中的每個(gè)元素都會(huì)被賦予自己的作用域和模板,同時(shí)每個(gè)每個(gè)模板實(shí)例的作用域都會(huì)暴露出一些屬性。
你可以利用其中的$indexProperties to accomplish what you want.

I have an example here. You can take a look at it, determine which one of the instructions you want to add, and then write your code. demo

You may have to go through a firewall to view the code. If you can’t browse it, I can take a screenshot for you.

過去多啦不再A夢(mèng)
<p ng-repeat="program in programs">
    <a class="pBlock" href="#" ng-if='$index == 4' rightCtrl></a>
    <a class="pBlock" href="#" ng-if='$index != 4'></a>
</p>
過去多啦不再A夢(mèng)

Use ng-if directive.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template