# \[Slides\] How to make Infinity Slides in ionic?(with dynamic content)

**URL:** <https://forum.ionicframework.com/t/slides-how-to-make-infinity-slides-in-ionic-with-dynamic-content/113318>\
**Category:** ionic-v3\
**Created:** [November 24, 2017, 6:52pm UTC](https://forum.ionicframework.com/t/slides-how-to-make-infinity-slides-in-ionic-with-dynamic-content/113318 "2017-11-24T18:52:08Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![user5555](https://avatars.discourse-cdn.com/v4/letter/u/8e7dd6/32.png) [@user5555](https://forum.ionicframework.com/u/user5555)\
**Post date:** [November 24, 2017, 6:52pm UTC](https://forum.ionicframework.com/t/slides-how-to-make-infinity-slides-in-ionic-with-dynamic-content/113318/1 "2017-11-24T18:52:08Z")

</div>

I want to have a view, where I can swipe right and left to navigate in dynamic content.  
My current approach:  
I have 3 slides in a loop on Sliding I change the data to match the new positions.  
My data is stored in an array like

```auto
weeks = [
 week1,
 week2,
 week3
];

```

It somewhat works, but on looping it displays old data ( when i touch it it refreshes to the real data ).

My questions are now:

1. does anyone have successfuly made an infinity slide with dynamic content?
2. do you have any working examples on this topic?

PS: only the visuals are buged -\> my code seems to work properly.

---

<div class="post-metadata">

**Author:** ![user5555](https://avatars.discourse-cdn.com/v4/letter/u/8e7dd6/32.png) [@user5555](https://forum.ionicframework.com/u/user5555)\
**Post date:** [November 24, 2017, 7:39pm UTC](https://forum.ionicframework.com/t/slides-how-to-make-infinity-slides-in-ionic-with-dynamic-content/113318/2 "2017-11-24T19:39:04Z")

</div>

My simplfied code:

```auto
<ion-slides (ionSlideDidChange)="slideChanged()">
    <ion-slide>
      1|{{i}}
    </ion-slide>
    <ion-slide>
      2|{{i}}
    </ion-slide>
    <ion-slide>
      3|{{i}}
    </ion-slide>
  </ion-slides>

```

```auto
  slideChanged() {
    let cI = this.slides.getActiveIndex();
    let pI = this.slides.getPreviousIndex();
    if (
      (pI == 1 && cI == 2 ) ||
      (pI == 2 && cI == 3 ) ||
      (pI == 3 && cI == 4 )
    ){
      //going forward
      console.log("->");
      this.i++;
    } else if (
      (pI == 1 && cI == 0 ) ||
      (pI == 2 && cI == 1 ) ||
      (pI == 3 && cI == 2 )
    ){
      //going back
      console.log("<-");
      this.i--;
    }
}

```

**Is there better way to get the direction?**

It resets the displayed data when looping:

:

 ![10](https://global.discourse-cdn.com/ionicframework/original/3X/9/e/9e88904faa32521f5d3de8c6d433cd9fedc20f38.png)swiping right-\> ![14](https://global.discourse-cdn.com/ionicframework/original/3X/5/c/5cd83bb96507e8e04b7d22e7b92a925cf8a3ab23.png)after touching it ![19](https://global.discourse-cdn.com/ionicframework/original/3X/5/5/55239ffb3beb630139e3609efed0d449f6ab32c8.png)  
the first number is the real slide number and the second is `i`

---

<div class="post-metadata">

**Author:** ![gezbo](https://avatars.discourse-cdn.com/v4/letter/g/c89c15/32.png) [@gezbo](https://forum.ionicframework.com/u/gezbo)\
**Post date:** [September 7, 2018, 9:16pm UTC](https://forum.ionicframework.com/t/slides-how-to-make-infinity-slides-in-ionic-with-dynamic-content/113318/3 "2018-09-07T21:16:07Z")

</div>

Did you ever resolve this?

---

<div class="post-metadata">

**Author:** ![user5555](https://avatars.discourse-cdn.com/v4/letter/u/8e7dd6/32.png) [@user5555](https://forum.ionicframework.com/u/user5555)\
**Post date:** [September 16, 2018, 8:10pm UTC](https://forum.ionicframework.com/t/slides-how-to-make-infinity-slides-in-ionic-with-dynamic-content/113318/4 "2018-09-16T20:10:32Z")

</div>

I don’t worked on it so I cant tell

---

<div class="post-metadata">

**Author:** ![Matesanz](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/matesanz/32/126257_2.png) [@Matesanz](https://forum.ionicframework.com/u/Matesanz)\
**Post date:** [June 27, 2019, 10:54am UTC](https://forum.ionicframework.com/t/slides-how-to-make-infinity-slides-in-ionic-with-dynamic-content/113318/5 "2019-06-27T10:54:51Z")

</div>

I’m also intereted on it  
Is out there any solution?  
Thanks

---

<div class="post-metadata">

**Author:** ![mhartington](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/mhartington/32/137757_2.png) [@mhartington](https://forum.ionicframework.com/u/mhartington)\
**Post date:** [July 19, 2021, 10:02pm UTC](https://forum.ionicframework.com/t/slides-how-to-make-infinity-slides-in-ionic-with-dynamic-content/113318/6 "2021-07-19T22:02:14Z")

</div>

Closed on July 19, 2021, 10:02pm UTC


