I am started to learn angular 4. I have multiple div section, each div section have button and content, once click the button clicked then will show the respective div, once click another button hide others.
<div *ngFor="let number of [0,1,2,3,4] ; let i = index">
<div>
<button (click)="showContent(this);"> Click Me {{index}} </button
<div class="content"> Hello world {{index}}</div>
</div>
</div>
Js code
export class AppComponent {
showContent(evt){
event.target.style.display = 'block';
}
}
Sorry, I added minimal code only.