访问使用angularjs NG重复嵌套数组 [英] Accessing the nested Arrays using ng-repeat in angularjs

查看:115
本文介绍了访问使用angularjs NG重复嵌套数组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

的jsfiddle

我不能够访问嵌套集合中的阵列的图像。为什么我不能看到任何输出?

I'm not able to access the array images in the nested collection. Why am I not able to see any output?

模型:

var obj = [{
    "id": "7",
    "date": "1 Jan",
    "images": ["507f42c682882", "507e24b47ffdb", "507e2aeca02d5", "507e2b19663a9"]
}, {
    "id": "7",
    "date": "1 Jan",
    "images": ["507f42c682882", "507e24b47ffdb", "507e2aeca02d5", "507e2b19663a9"]
}];

这是NG-重复的HTML:

This is the HTMl with ng-repeat:

<ul>
    <li ng-repeat="img in item"> 
        <br /> 
        <li ng-repeat="img1 in img.images">{{img1}}</li>
    </li>
</ul>

任何人都可以点我很想念我?

Can anyone point me to what I'm missing?

推荐答案

问题是你试图重复里的列表的<$ C $放在元素C>里元素,它是无效的HTML。因此,角将不会呈现这一点。

The problem is you are trying to repeat a list of li elements inside of a li element, which is invalid HTML. As such, angular will not render this.

更新您的HTML:

<ul>
    <li ng-repeat="img in item"> 
        <ul>
            <li ng-repeat="img1 in img.images">{{img1}}</li>
        </ul>
    </li>
</ul>

这篇关于访问使用angularjs NG重复嵌套数组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆