RC5: Sliders slider.getSlider() return undefined


#1

I am using Slider, after update to RC5 the method getSlider for slider component return undefined, How I can fix this?

The documentation says “ion-slides, getSlider() has been removed. Please use the properties and methods on the instance of ion-slides instead.”, Which property can replace this?

Why I need it ?, I am using it to update the slider page content after the user slide left or right.

let swiper = slider.getSlider();       
 setTimeout(() => {
    swiper.update();
    swiper.init();
  });

#2

Take a look a the slides component src

we’ll be adding more docs for this, but a majority of the properties are listed there.
Note that some of them will not be there, since they’re no long needed.
Like swiper.init has been removed since it is now a proper ng2 component.


#3

I have tried slider.update(), it works well if the sliding direction is left to right, but when the sliding direction is right to left, the update does’t work.

My slider has initially one slide and I am setting loop=true.

here is the method which updates the slider on user slide right or left.

 update(val) {
let slider = this.slider;
let month = this.moment();
month.month(this.months[0].month);
month.year(this.months[0].year);
month.add(val, 'month');
this.months[0] = this.cal.createMonth(month.month(), month.year());

setTimeout(() => {
  slider.update();
 }, 100);

}

ionSlideNextEnd() {
let currentIndex = this.slider.getActiveIndex();
console.log(“Current index is”, currentIndex);
this.update(-1);
}

ionSlidePrevEnd() {
let currentIndex = this.slider.getActiveIndex();
console.log(“Current index is”, currentIndex);
this.update(1);
}

Anyone can help ?


#4

@mhartington Any Help ?