Ion slide not working when navigate back in ionic 4

Hi I am getting issue on ion slide when i navigate back to home page ion slides not working by default

Hi @mehraj7860 Can you please provide the code ?

@ViewChild('slides', { static:false }) slides: IonSlides;

 this.sliderThree =
    {
     
      slidesItems: [
        {
          id: "../../assets/images/market.jpg",
          name:"Sumo"
        },
        {
          id: "../../assets/images/mobile.jpg",
          name:"Shelcal 500"
        },
        {
          id: "../../assets/images/test.jpg",
          name:"Orofer Xt"
        },
        {
          id: "../../assets/images/market.jpg",
          name:"Dexorange Capsule"
        },
        {
          id: "../../assets/images/mobile.jpg",
          name:"Women's Horlicks"
        },
        {
          id: "../../assets/images/mobile.jpg",
          name:"Hair Shampoo Hair"
        }
      ]
    };
  async slideChange() {
    
    await this.slides.update();
  }

Here is my html code

 <ion-slides [options]="option"  #slides  (ionSlideDidChange)="slideChange()">
          <ion-slide *ngFor="let item of sliderThree.slidesItems" style="width:90%;height:20vh;">
              <ion-card style="width:90%;height:20vh;
              display:-webkit-box;
              overflow:hidden;border:1px solid grey;"  (click)="labTest()">
                  <img [src]="item.id" style="width:100%;height:20vh;
                  display:-webkit-box;" alt="">
             </ion-card>
          </ion-slide>
        </ion-slides>

can you check this and let me know why its not sliding when i navigate back to same page

have you mentioned any property in Option… and exactly what issue you are facing when you navigate back.

  option = {
    slidesPerView: 1,
    spaceBetween: 10,
    centeredSlides: true,
    speed:1000,
    loop:true,
    autoplay:{disableOnInteraction:false}
  }

this is my option i am facing problem only for ion slide default slide is not working when i navigate back

I think the problem with the initialslide and that you have not mentioned here, please mention and check if it works
initialSlide: 1

1 Like

not working i tried this also can you check with your system by using these code and let me know what changes i have to do…i am using ionic 4

its working fine for me… and why it is required to mention this as I am getting error after removing this from this.sliderThree it working fine.

Please refere this hope this helps you

public ionViewWillEnter(){
    this.slides.update();
}

i tried this not working in ionic 4 and i declare slideThree:any in class so i am using this.slideThree