Hey there, fellow coder!
I'm still getting the hang of Angular 2 and Typescript, so please be patient with me as I learn.
I am working on a project where I have 5 buttons that should toggle the visibility of content, similar to a side menu. Below is the code snippet for this functionality:
HTML - Code
<li class="navigation-items">
<button class="dropdown-header" (click)="onSelect(2)">Link 2</button>
<div *ngIf="DropdownVar == 2" class="dropdown-content">
<a href="#">Link 1</a>
<a href="#">Link 2</a>
<a href="#">Link 3</a>
</div>
</li>
Typescript - Code
DropdownVar = 0;
onSelect(x){
this.DropdownVar = x;
console.log(x);
}
Currently, it seems like my variable is getting updated correctly, but the *ngif directive is not working as expected. Are there better approaches to solve this issue?
Additionally, I would like to add some animations to the content that is being displayed. I believe CSS can help in achieving this effect.