1

I'm using Ionic's slides component (based on Swiper) and it works great. However, I have a specific use case where I need to set the slider's spaceBetween option based on an async call.

I tried using the .update() method but without any effect.

public sliderOptions: Slider = {
    spaceBetween: 0
}

async ngOnInit() {
    await this.getDocuments();
}

async function getDocuments() {
    //this.sliderOptions.spaceBetween = -75; (HERE IT WORKS)

    let response = await this.service.getDocuments();

    this.sliderOptions.spaceBetween = -75; // DOESN'T WORK
    this.slides.update().then(() => console.log('SLIDER UPDATED'));
}

<ion-slides #slides [options]="sliderOptions">
....
</ion-slides>

What am I doing wrong?

shAkur
  • 944
  • 2
  • 21
  • 45
  • Could you please create a stackblitz demo with the issue? You can use this **[starter project](https://stackblitz.com/edit/ionic-5-starter-app?)** if you want :) – sebaferreras Nov 20 '20 at 12:55

0 Answers0