ng-repeat的个别课程

时间:2016-11-10 01:12:32

标签: angularjs ng-repeat ng-class

我正试图找出一种简单的方法来将单个类添加到我的ng-repeat

public class Colision : MonoBehaviour {

    public Text points;
    int contador = 0;
    int Veces_Pequeño = 0;
    public string beforeText = "record: "; //just added this so it is easy to change in unity editor

    void Start(){
        points.enabled = false;
    }

    void OnCollisionEnter(Collision col){
        if ( col.gameObject.name == "Cube") {
            col.gameObject.SetActive (false);
            points.text = beforeText + contador.toString();
            points.enabled = true;
        }

        if ( col.gameObject.name == "Cube1") {
            col.gameObject.SetActive (false);

            points.text = beforeText + contador.toString();
            points.enabled = true;
        }
    }
}

我的数据来自:

            <div class="panel-body">
                    <ul class="instagram-list" id="feed" ng-repeat="item in items track by $index">    
                        <li class="box">
                            <a ng-href="{{item.link}}" target="_blank">
                                <small>{{item.caption.text}}</small>
                                <img ng-src="{{item.images.standard_resolution.url}}" width="294">
                            </a>
                        </li>
                    </ul>                       
                </div>

我已经尝试制作一个循环遍历每个项目的sass循环,基本上只是在每个类的末尾添加一个数字,例如:box - {{}}。但是我撞墙而且没有想法我还能做些什么。

1 个答案:

答案 0 :(得分:0)

通过将以下代码添加到我的box元素来更新代码。

ng-class="box-{{$index}}"