循环嵌套JSON

时间:2015-11-29 21:11:33

标签: angularjs

我有类似于报告的部分:

{
    "id": 2,
    "order": 0,
    "report": 2,
    "title": "Why winters suck",
    "content": "<p>content here</p>\r\n",
    "children": [
        {
            "id": 3,
            "order": 1,
            "report": 2,
            "title": "Lol winters are terrible",
            "content": "<p>very bad</p>\r\n",
            "children": []
        }
    ]
},

正如你所看到的,一个部分可以有无数个孩子任意数量的级别。我希望能够将它们全部嵌套在彼此之下。目前我有一些看起来像这样的东西:

<div ng-class="{active: isSelectedSection(section.id)}"  ng-repeat="section in sections | filter:{report:currentReport.id}">
                    {{section.title}}
</div>

仅显示第一级报告。如何才能显示子节?

0 个答案:

没有答案