Ion-slides 1.2.1 ionic. How to get active slide?

Tried a watch on the slider. Didnt work. What worked for me is this.

$scope.swiperOptions = { /* Whatever options */ effect: 'slide', initialSlide: 0, /* Initialize a scope variable with the swiper */ onInit: function(swiper){ $scope.swiper = swiper; }, onSlideChangeEnd: function(swiper){ console.log('The active index is ' + swiper.activeIndex); } };

HTML
<ion-slides slider="swiper" options="swiperOptions"> <ion-slide-page><h1>TEST HEADER 1</h1></ion-slide-page> <ion-slide-page><h1>TEST HEADER 2</h1></ion-slide-page> <ion-slide-page><h1>TEST HEADER 3</h1></ion-slide-page> </ion-slides>

10 Likes