In my angular2 project i have implemented angular tree component.i am using the following json data
nodes = [
{
id: 1,
name: 'root1',
isExpanded: true,
children: [
{ id: 2, name: 'child1' },
{ id: 3, name: 'child2' }
]
},
{
id: 4,
name: 'root2',
children: [
{ id: 5, name: 'child2.1' },
{
id: 6,
name: 'child2.2',
children: [
{ id: 7, name: 'subsub' }
]
}
]
}
];
And my html template is,
<tree-root [nodes]="nodes"></tree-root>
getNodeName()
{
//display selected node name
console.log();
}
Tree displaying in my tree,but my problem is, how can i get clicked node details. i want to print selected node name inside the getNodeName() function.