bug: ion-slide-box with two slides and does-continue does not work correctly
Type: bug
Platform: all
hey guys in the rc4 and last nightly i use an ion-slide-box with the does-continue attribute and two slides.
http://codepen.io/bengtweisse/pen/PqYyvM
you can scroll to the second slide, but not back and not forward. If you swipe back from the first slide the pager is not correct. In the dom you can see more than two ion-slides.
If you resize the window there are suddenly four pager-"points".
If you add a third slide everything works fine.
+1
+1
I have met the same problem recently, and when checking the ioinc souce code of "ionic.bundle.js", I found this souce as below:
special case if two slides
if (browser.transitions && options.continuous && slides.length < 3) {
element.appendChild(slides[0].cloneNode(true));
element.appendChild(element.children[1].cloneNode(true));
slides = element.children;
}
It seems like that If and only if the slide count is 2, ionic will double the count while setting up. I don't quite understand why the author added this special case, and how to fix it properly,
I am having the same problem now, +1
Same here. +1
Same problem. +1
+1
+1
Also having an issue with two slides (+1).
I was able to find a temporary fix for my issue.
My issue was slightly different than the original post in that the pager was showing two pager icons but actually had four slides. When you got to slides 3 and 4 (which were duplicates of 1 and 2), no pager icon was selected. So, whenever I only have two slides and the slide changes (using on-slide-changed), I check the current index via $ionicSlideBoxDelegate.currentIndex(). I have an ng-class applied to the slidebox if the index is 2 (ex: 'first-slide') and one when it is 3 (ex: 'second-slide'). I also overrode the css for the .first-slide .slider-pager span:first_child and .second-slide .slider-pager span:nth-child(2) to have opacity: 1.
This change makes it appear that there are only 2 slides, even though there are really 4. This wouldn't work if the issue didn't let me slide through like in the original post, but for my issue it was good enough until there is a fix.
Edit: Just found that on some devices it's showing 4 pagers. So, I am now applying an ng-class on the slidebox when there are two slides (ex: 'two-slides'). Then I had to modify the css to set .two-slides .slider-pager span:nth-child(3) and .two-slides .slider-pager span:nth-child(4) to have display: none. This appears to work.
have the same issue as tflavin, 4 slides and only two slides, but if i open a modal over the page when the modal is closed the sliders become 4.
@tflavin +1 two slides should definitely not be changed into 4 slides. It's counter intuitive. Or at least it should be in the docs !
Having the same problem. Any proper fix yet?
same issue...+1
+1
Same here with 1.1.0
+1
Another work around is to special case your model to explicitly duplicate your array in the pattern [0, 1, 0, 1] if it has 2 elements.
Hey,guys, I add the following code to my controller script, and it seems that that bug disappeared. function loadIds() is to get json data from server and store data into $scope.ids
$scope.$on('$ionicView.beforeEnter', function(){
if($scope.ids.length == 0){
$scope.loadIds();
}else{
$ionicSlideBoxDelegate.update();
$ionicSlideBoxDelegate.loop(true);
}
});
It seems the copied objects don't inherit the data in their scope, causing the following code to not work:
ng-click="goTo(post)"