0
votes

I am working in Angular ,

  • Where I have created a tree based structure
  • on going down to tree structure there is a dropdown button name "Dropdown"
  • Problem is on clicking to "Dropdown" button dropdown is not working .

Kindly check I am putting stackblitz link below for the code

https://stackblitz.com/edit/angular-tree-un?file=src%2Fapp%2Fapp.component.html

1
Could you provide relevant code into your question?Plain_Dude_Sleeping_Alone
If you inspect the DOM, you'll see that the dropdown div is inserted in the DOM. its css class is dropdown-content, and this class sets display to none, so even if they're in the DOM, you can't see them.JB Nizet

1 Answers

0
votes

I made some changes please see whether it's as per your expected output or not.

Ts file

myFunction(value) {
console.log(value);
if (value == 1) {
  this.availableBtn = !this.availableBtn;
}

if (value == 2) {
  this.vaccanttoggle = !this.vaccanttoggle;
 }
}

HTML File

<div id="myDropdown" *ngIf="availableBtn">
<a href="#">Link 1</a>
<a href="#">Link 2</a>
<a href="#">Link 3</a>

seems like there is problem with class="dropdown-content". remove it and try.