Currently I have slides that show the number of index in the bullets, but I am not able to find out how to have a custom text inside that bullets instead of the index number.
Here is a fiddle of the result that I want to achieve, but it is in JavaScript, I don’t know how to achieve that in Ionic2:
Hi @croi, you should check out the post I wrote over here. Check out the iDangerous Swiper api, it talks about the paginationbulletrender functionality.
You should attach options to your Swiper. How to do that is also explained over there. Then you should set the option PaginationBulletRender, and you can apply your custom class styles. The option example from their docs looks something like this:
Hi there! You’re already on the right path. Since you pass the corresponding index of the slide, you can just reach the category by accessing it through categories[index] inside your paginationBulletRender option.
Some further clarification:
As you can understand it only shows the slide number at this point, namely index + 1. Since an array starts (as you probably know very well) at index zero, index + 1 gives you the first slide in case it’s index is zero etc etc.
Since you’re iterating through an array of some sort, the index numbers of the slides are equal to the category shown. In other words, if you want to display some info of the active category, just grab the same position out of the categories array by doing this: categories[index]. if it’s an object of some sort, display it with categories[index].category or whatever property you want to use. If it’s just a flat array with strings, setting categories[index] should be enough.
Then your option property should be something like: