Ionic-framework: $ionicSlideBoxDelegate doesn't work with new ion-slides

Created on 29 Jul 2016  路  6Comments  路  Source: ionic-team/ionic-framework

I need to change the ion-slide-page dynamically, so, as says in the ion-slides docs I need to use $ionicSlideBoxDelegate.

And in the $ionicSlideBoxDelegate docs they says which I need to use the slide method.

So I tried with:

var secondSlide = 1;
$ionicSlideBoxDelegate.slide(secondSlide);

But doesn't work. Nothing happens, does not throw any errors.

There isn't any way to do that with the new and non deprecated ion-slides?


My environment:

Cordova CLI: 6.2.0
Ionic Framework Version: 1.3.1
Ionic CLI Version: 1.7.16
Ionic App Lib Version: 0.7.3
Node Version: v4.2.2

Most helpful comment

Hi @joanebrown,

The ion-slides uses the underlying API of Swiper mentioned at the top of the slide-boxes docs. So you've grabbed a reference to the slider onInit ($scope.slider), and then looking at the Swiper API you can use $scope.slider.slideTo(index) or in your case $scope.slider.slideTo(slider). I updated your plunkr.

I may be wrong, but I believe the $ionicSlideBoxDelegate is only for the old ion-slide-box component, where you're using the ion-slides component.

Cheers

All 6 comments

Hello, thanks for opening an issue with us! Would you be able to provide a plunker that demonstrates this issue? Thanks for using Ionic!

Here is a codepen:

https://codepen.io/anon/pen/oLrYzq?editors=1010

As you can see, the $ionicSlideBoxDelegate.slide(); doesn't work.

Hi @joanebrown,

The ion-slides uses the underlying API of Swiper mentioned at the top of the slide-boxes docs. So you've grabbed a reference to the slider onInit ($scope.slider), and then looking at the Swiper API you can use $scope.slider.slideTo(index) or in your case $scope.slider.slideTo(slider). I updated your plunkr.

I may be wrong, but I believe the $ionicSlideBoxDelegate is only for the old ion-slide-box component, where you're using the ion-slides component.

Cheers

Ooops! You're right. Thank you very much. :)

$ionicSlideBoxDelegate has now been deprecated.

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.

Was this page helpful?
0 / 5 - 0 ratings