Slidebox does-continue doesn't work on iPad


#1

Hi,

I have a problem with looping slidebox on iPad. I set attribute on ion-slide-box:

<ion-slide-box show-pager="false" does-continue="true">

It works as expected when I run the app on desktop browsers. However, when I run the app on iPad simulator, the slidebox stops on first and last slide, as the attribute was not set.


#2

Ok, I found what is the issue. At first slidebox gets list with undefined elements (I create slidebox dynamically with ng-repeat). It’s somehow causes that does-continue is not working after the list is filled with objects (I do $ionicSlideBoxDelegate.update() but it doesn’t help).


#3

Try to call the update method everytime you enter the view using the

$scope.$on(’$ionicView.enter’, function(){
$ionicSlideBoxDelegate.$getByHandle(‘towords-slide’).update();
})

if this doesn’t solve the problem, try adding the

$timeout(function(){

},0)

to contain the update method to ensure it runs after the first digest cycle of angular when entering a view.

Refer to this http://ionicframework.com/docs/api/directive/ionView/


#4

i tried your method but the slides still don’t loop
the slides count is still 0 even after update


#5

I was able to work around this problem by putting an ng-if condition in the slidebox tag. This makes sure the entire slidebox isn’t initialized until your slides are ready.

<ion-slide-box does-continue="true" ng-if="mySlides.length">
    <ion-slide ng-repeat='slide in mySlides'>
    ... content ...
    </ion-slide>
</ion-slide-box>

The looping feature continued to work for me even when I subsequently added more slides. Just be sure to call $ionicSlideBoxDelegate.update().

It does seem like ion-slide-box’s initialization code setup something that update() should also setup/reset. I hope this workaround gives ionic team some clue to fix this issue.


#6

Actually it didn’t solve the problem for us,
If someone is the same problem that might be useful as ‘emergency fix’.

I’ve recently done some research and the actual problem seem to be here:

// do not setup if the container has no width
if (!container.offsetWidth) {
return;
}

I have temporarily commented this line (it seem to be some performance tuning ?)

will put some more details/fork and and write a test if find a spare minute.
Version used: 1.1


#7

This is the fix for my app, thank you!


#9
<ion-slide-box does-continue="true" ng-if="mySlides.length">
<ion-slide ng-repeat='slide in mySlides'>
... content ...
</ion-slide>

It works for me