SlideBox update() doesn't work with left-growing array
When adding elements to the slidebox input array (ng-repeat) at the end of the array with push(), an update() works as expected: the new slides are added and the current slide is shown. If elements are added at the beginning of the array (unshift()), the update() is not working properly: the indexes don't adjust to the current position of the actual element.
I've made a CodePen example to illustrate the problem: http://codepen.io/anon/pen/rtiyB
@guillermin thanks for the code pen. I'm still trying to understand the issue. What exactly should happen here?
Basically, when you add a color to the left, you also "move" left because your index is now off by 1, since adding an element at 0 makes all previous items increment their index by 1.
This does not happen when adding an element to the right, where the new element gets a new (autoincrementing) index and everything else stays the same.
I've managed a workaround in my app with:
setTimeout(function(){
$ionicSlideBoxDelegate.slide($ionicSlideBoxDelegate.currentIndex()+1));
});
but it produces a noticeable flicker. I was hoping to implement it directly in update() so the index could be updated before setup(), and therefore require no extra slide().
Ah I see what you mean @guillermin. Thanks.
I'm having the same issue, but I'm trying to do a $scope.data.splice(n, 1); sort of situation.
It seems that adding an element works better than removing. Removing puts the whole slidebox into a broken state. You can verify this in the CodePen above by changing the unshift() to be a splice(0, 1). Any workarounds for this would be much appreciated.
This appears to be fixed with @ajoslin's update to slidebox http://codepen.io/perrygovier/pen/gCplv
There is still an issue with left-shrinking arrays. Open up the codepen above and change the unshift() to shift() (make sure you're currentIndex() is 1 so you don't unshift yourself off a cliff).
When you click on the slidebox, the entire view disappears.
I am trying the exact same thing @motionsmith is doing, any help would be appreciated. Slide box slipce puts the entire slide box into a broken state. if i splice the first index (0) it doesn't update and overlaps with last index image.
+1 any news on this?
any update on this?