I'm using Ionic 6 and wanted to zoom into a slide:
let zoom = this.slider.nativeElement.swiper.zoom;
if(zoomIn){
zoom.in();
console.log("zoom in ")
}else{
zoom.out();
console.log("zoom out ")
}
This worked perfectly in Ionic 4, but using Ionic 6 it only works after zooming in/out in my Chrome Tab. Can anybody help me with this?
I call the zoom function on this element:
<ion-slides [options]="sliderOpts" #slider zoom>
<ion-slide>
<div class = "swiper-zoom-container">
<img src="{{ 1.jpg}}">
</div>
</ion-slide>
</ion-slides>
UPDATE: changing the Viewchild Method and add the IonViewDidEnter() like following solved the problem for me:
@ViewChild(IonSlides, {static: false})slider: IonSlides;
ionViewDidEnter(){
this.slider.update();
}