I successfully created a modal with an image slider using the bootstrap ngb-carousel.
Is there a way to dynamically display the current image's name in the modal header and the numbering of images in the modal footer?
For example, I want the modal header to show the name of the current image, and the footer to display the image number out of total images. So, if I have 3 images and I am on the first one, the footer should display '1/3'. This should update as I change images on the slider.
If anyone has suggestions or solutions for implementing this functionality, it would be greatly appreciated! I haven't been able to figure out how to achieve this so far.
Code
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#myModal">
Show images Modal
</button>
<div class="modal" id="myModal">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title">Name Image !</h4>
<button type="button" class="close" data-dismiss="modal">×</button>
</div>
<div class="modal-body">
<ngb-carousel id="carousel" #carouse *ngIf="data" (slide)="change($event)">
<ng-template *ngFor="let imgIdx of data; let i = index" [id]="i" ngbSlide>
<div class="picsum-img-wrapper">
<img [src]="imgIdx.image" [alt]="">
</div>
<div class="carousel-caption">
<h3>{{imgIdx.head}}</h3>
<p>{{imgIdx.data}}</p>
</div>
</ng-template>
</ngb-carousel>
</div>
<div class="modal-footer">
Number images (1/3)
</div>
</div>
</div>
</div>