我想递归一个对象来填充表格。
为此,我使用ng-include
和ng-repeat
来通过对象并为每个新元素创建一个新的<tr>
,但它在第一个级别后失败。
答案 0 :(得分:0)
您正在创建新数组而不是新对象。试试这个:
"nodes": [{
"name": "Level 1",
"att1": "att1-level1",
"att2": "att2-level1"},
{"name": "Level 2",
"att1": "att1-level2",
"att2": "att2-level2"},
{
"name": "Level 3A",
"att1": "att1-level3a",
"att2": "att2-level3a"}
, {
"name": "Level 3B",
"att1": "att1-level3b",
"att2": "att2-level3b"
}]