I am new to angular and having an issue with hide and show content. I have 3 buttons, button A, button B and button c. When i click on button A, the content of the button A ie div A should be visible,the content of button B ie div B and button C ie div C should hide like that.
But i can display the respective divs when clicked on the respective buttons, but i am not able to hid the other two divs.
Can any one help me out.
Thanks in advance.
Please find below the code which i am trying out.
previousWeekData(){
console.log("Previous Button Clicked");
this.isShow = !this.isShow;
}
nextWeekData(){
console.log("Next Button Clicked");
this.isShow = !this.isShow;
}
todaysWeekData(){
console.log("Todays Button Clicked");
this.isShow = !this.isShow;
}
<div class="container">
<div class="row">
<div class="col-md-4">
<div class="btn-group">
<div class="btn btn-dark" [(viewDate)]="viewDate" (click)="previousWeekData()">
Previous
</div>
<div class="btn btn-outline-secondary" (click)="todaysWeekData()">
Today
</div>
<div class="btn btn-dark" [(viewDate)]="viewDate" (click)="nextWeekData()">
Next
</div>
</div>
</div>
</div>
<div class="row">
<div *ngIf = "isShow">Previous week datay.</div>
<div *ngIf = "!isShow">Next week data.</div>
<div *ngIf = "isShow">Current week data</div>
</div>
</div>