Use slider methods in Ionic 2


#1

In Ionic 2 we can use the slider component () which is a “wrapper” to this Slider component, according to the docs:
http://idangero.us/swiper/api/

Is it possible to access the slider methods within Ionic?
Example: how do I trigger mySwiper.slideNext() within my app? According to the Ionic API, itś not possible (or not documented): http://ionicframework.com/docs/v2/api/components/slides/Slides/.


#2

Answring my own question: it’s possible to set callbacks to the events within the config options.

Example:

this.options = {
   onTransitionEnd: (swiper, event) => {
      //do something
   }
};
---
<ion-slides [options]="options"></on-slides>

#3

You are amazing !!! That helped a lot.
If you want to change something every time you swipe forward which function do you have to use?


#4

In the onTransitionEnd use the activeIndex and previousIndex values from the swiper object to compare them (check if active is greater then previous) and do what you need.