I'm looping through images which oncliking a modal pops up with its info. The problem is that all the modals from all images appear to have the same , that of the first image
Here's what i've done.
data:any;
Html
<div *ngFor =" let mydata of data">
<img [src]="mydata.image" >
<a href="" data-toggle="modal" data-target="#exampleModal">View info </a>
<!-- Modal -->
<div class="modal fade " id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true" style="">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">Modal title</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<p>{{mydata.info}}</p>
</div>
</div>
</div>
</div>
</div>
I Got the solution from here