我已經開始使用Clarity Design Angular項目,並遇到了0.10.0-alpha中提供的Tree View遞歸模板的問題。Clarity設計樹視圖遞歸問題
https://plnkr.co/edit/KK8rVH1xUGCO7VetgomA?p=preview
selectableRoot = {
"@name": "A1",
"selected": false,
"expanded": true,
"children": [
{
"@name": "B1",
"selected": false,
"children": [
{ "@name": "C1" },
{ "@name": "C2" },
{ "@name": "C3" }
]
},
{
"@name": "B2",
"selected": true,
"expanded": true,
"children": [
{ "@name": "D1" },
{
"@name": "D2",
"selected": false
},
{ "@name": "D3" }
]
},
{
"@name": "B3",
"selected": true,
"children": [
{ "@name": "E1" },
{ "@name": "E2" },
{
"@name": "E3",
"children":
{ "@name": "F1" }
}
]
}
]
};
當遞歸檢查命中不包含陣列的匹配(但只是一個對象 - 見A1> B3> E3> F1)時,它未能呈現該信息並引起單擊插入符號後,任何可摺疊節都會複製子項的錯誤。
如果只有一個實例,如果發送JSON的API沒有將子項放入數組,則不知道如何解決此問題。遞歸應該考慮只有一個孩子存在的情況(並且不在數組內)。
您應該使用'ngProjectAs'和'ng-container'來確保Tree正確呈現,如下所示:https://plnkr.co/edit/cUCWhQxaEQxnEIGuxF1c?p=preview – takeradi
感謝您的替代@takeradi。這是防止我遇到的間距問題。我會更多地關注這些指令! – bangelakos