我有以下問題: 讓我們假設我有Component A
有兩個subcomponents Ar
和Ad
。 Subcomponent Ar
是遞歸創建樹,subcomponent Ad
是顯示有關遞歸樹中選定節點的詳細信息的組件(subcomponent Ar
)。如何使用@Output
從Ar
中的子(子)組件向Component Ad
發送選定節點?應該是@Output
還是別的?Angular2遞歸組件輸出
app.component.html:
<tree [input]="fooTree" [output]="updateDetails($event)"></tree>
<tree-details [input]="input"></tree-details>
tree.component.html:
<tree [input]="fooTree.children"></tree>
樹details.component.html
<div>{{input.name}}</div>
<div>{{input.id}}</div>
在這種情況下,我只會看到根樹的詳細信息,如何才能從其他節點(遞歸創建的一個節點)獲取信息,何時被選中?
但隨着tree.component.html什麼?不應該有任何輸出? – ulou
是的,它的遞歸,不記得它.. – mxii
這是我需要的exatcly。非常感謝你 :) – ulou