To toggle the corresponding node, the button should be able to toggle its state. Each time the dropdown button is clicked, a value that determines whether the dropdown should change in the node is updated. A property called isSelected needs to be added to the nodes to control whether a node should be displayed or not. Although it's unclear why that vacant node is being handled differently, the normal nodes should function as described below.
Utilize Akhil's code since it has already been tested, and make adjustments like so:
{
name: "Raghavendran M",
me_code: "6000001",
tl_code: "N.A.",
rs_id: "09565792-c288-4885-a4ed-3dd055f250f5",
role: "ME",
isSelected:false
}
myFunction(value,node){
node.isSelected = !node.isSelected;
}
}
<div class="dropdown">
<button (click)="myFunction(1,node)" class="dropbtn">Dropdown</button>
<div id="myDropdown" class='dropdown-content' *ngIf='node.isSelected' >
<a href="#">Link 1</a>
<a href="#">Link 2</a>
<a href="#">Link 3</a>
</div>