Big bug with slideBox selected attribute

Hey guys,

I was going crazy with my app today, and was finally able to reproduce the huge (and really weird) behavior bug I have regarding slidebox and the selected attribute.

First of all, take a look at this pen :

So now, I’ll break down the different behavior it produces :

Consider two states :

  • Slides, which contains a slidebox with 4 slides (respectively 1,2,3,4)
  • Home, which contains 4 links to the slidebox with the slideIndex as a parameter (#/tab/slides/:slideIndex)

So now, let’s start with the “working” case : you click on the 4th link (go to the fourth slide), and you can see that you can slide back to every other slides.

Let’s continue with the “I don’t understand what is happening” case : you click on the third (or second link), you arrive on the third (respectively second slide). But now you can’t slide to the fourth slide, but you can slide back to the second and the first. So slide back to the second and “tadaa” you can now slide to the fourth slide.

And now, for my “grand final” : you click on the first link, which brings you to the first slide. You can’t slide back as expected, but if you slide forward : there is no more slide and you can’t slide back : everything is now gone.

@adam , since you are my favorite wizard, can you please help me with this? Has anyone encounter the same issue?

Thanks a lot and sorry for the long post

1 Like

I’ll take this, since I’ve been working on the slidebox lately.

This is madness! Looking into it.

1 Like

Thanks a lot Andy! Now YOU are the best wizard!

1 Like

The problem was you were setting the selected binding to a string, not an integer.

I’ve committed a fix which will try to parse things to int, and not select if it’s invalid: https://github.com/driftyco/ionic/commit/8fe58b4a2470f545bb7919b6829d338a83fb1dc9

You can either wait for the nightly build to update, or add parseInt($stateParams.slideIndex) to your code.

1 Like

Well @andy and @adam, you are now both my favorite wizards! Thanks a lot for the quick fix, you guys are the best :heart:

3 Likes