javascript - angular ng-repeat的问题
PHP中文网
PHP中文网 2017-05-15 17:14:10
0
5
693

我本地写了个json文件叫demo.js,然后我想ng-repeat里面的数据。现在遇到的问题是:
我不知道怎么循环出roles的数据。

{
    "demoData": [
        {
            "dp": "aaa1",
            "name": "用户名1",
            "number": "11111",
            "score": "22222",
            "salary": "11111",
            "jobs": "scripts",
            "roles": [
                {
                    "new": "bbb",
                    "edit": "ddd",
                    "ccc": "aaaa",
                    "del": "dddd"
                }
            ],
            "other": "备注",
            "action": "删除"
        },
        {
            "dp": "bbb",
            "name": "用户名1",
            "number": "11111",
            "score": "22222",
            "salary": "11111",
            "jobs": "scripts",
            "roles": [
                {
                    "new": "bbb",
                    "edit": "ddd",
                    "ccc": "aaaa",
                    "del": "dddd"
                }
            ],
            "other": "备注",
            "action": "删除"
        }
    ]
}
PHP中文网
PHP中文网

认证0级讲师

全部回复(5)
曾经蜡笔没有小新

雷雷

迷茫

雷雷

習慣沉默

雷雷

过去多啦不再A梦

两层嵌套即可解决

習慣沉默

嵌套循环

<p ng-repeat="item in demoData">
    <p ng-repeat="item2 in item.roles">
        {{item2}}
    </p>
</p>
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板