I am trying to show an image preview using ion-slide inside the ion-modal. But zoom functionality is not working. I have added slideOptions. But not working. Subsequently, the zoom functionality is working with the normal page.
Second issue backdropDismiss : true
not closing modal when the backdrop is clicked
here is the code
page.html
<ion-slides [options]="slideOpts">
<ion-slide *ngFor="let p of products">
<img [src] = 'p.image_url' tappable (click)="openPreview(p.image_url)">
</ion-slide>
</ion-slides>
page.ts
async openPreview(image_url){
console.log(image_url)
const modal = await this.modalController.create({
component: ImageModalPage,
showBackdrop:true,
backdropDismiss: true,
componentProps: {
image_url : image_url,
},
});
return await modal.present();
}
modal.html
<ion-item class="close-fake" lines="none" text-center>
<ion-button (click)="close()" fill="clear" color="light">
<ion-icon name="close" slot="start"></ion-icon>
back
</ion-button>
<ion-slides [options]="sliderOpts">
<ion-slide>
<div class="swiper-zoom-container">
<img [src] ='image_url'>
</div>
</ion-slide>
</ion-slides>
modal.ts
sliderOpts = {
zoom: {
maxRatio: 5,
}
}
close(){
this.modalController.dismiss()
}