0
如何爲每個角度樹根節點的子項指定鏈接或函數? .TS如何爲每個角度樹根節點的子項指定鏈接或函數?
nodes = [{id:1,name:"parent",children:[{id:2,name:"children1"},
{id:3,name:"children2"}]
}];
// edited after advise from @SachilaRanawaka
handleEvent(event){
alert(event.eventName);
}
如何指定的鏈接(如A HREF?路由器?)或函數,在點擊運行的.html
<!-- edited after advise from @SachilaRanawaka,
somehow (onToggle) is not having any reactions
but (click) has-->
<tree-root #tree [nodes]="nodes" (click)="handleEvent($event)"></tree-root>
例
例children1還是children2?
是否有房產?
東西沿着這行:
nodes = [{id:1,name:"parent",children:[
{id:2,name:"children1", link:"/test/children1.html" },
{id:3,name:"children2", link:"/test/children2.html" }
]
}];
下面是關於樹的我使用的是怎樣的一個鏈接:Angular 2 Tree
什麼是''?如果這是您的自定義組件,我們怎麼知道是否有一個屬性?鏈接或功能應該做什麼? –
@GünterZöchbauer,道歉,我已經包含了一個指向我所指的angular2樹的鏈接。 – Ronaldo
你不能使用一個事件來調用函數https://angular2-tree.readme.io/docs/events#activate –