# How to create dynamic slides

**URL:** <https://forum.ionicframework.com/t/how-to-create-dynamic-slides/54772>\
**Category:** ionic-v3\
**Created:** [June 14, 2016, 12:08pm UTC](https://forum.ionicframework.com/t/how-to-create-dynamic-slides/54772 "2016-06-14T12:08:20Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sky9928](https://avatars.discourse-cdn.com/v4/letter/s/c77e96/32.png) [@Sky9928](https://forum.ionicframework.com/u/Sky9928)\
**Post date:** [June 14, 2016, 12:08pm UTC](https://forum.ionicframework.com/t/how-to-create-dynamic-slides/54772/1 "2016-06-14T12:08:20Z")

</div>

So i need to have dynamic slides. So i have three buttons. Each buttons A, B, C give different contents. I have successfully create that but it is buggy. When i click button to get different content there is bug in slides (example have 3 images) The first one is skipped in end loop and sometimes the first image from other data from other content is still exist (So if i move from content A (Have 3 images) to content B (have 3 images). The slides have 4 images (the first one is from A but the first one from B is skipped/move very fast). Here is the example method in each buttons:

```
 loadFeatured(){
    this.featuredService.loadFeatured()
    .then(dataFeatured => {
      this.featureds = null;
      this.featureds = dataFeatured;
      this.featuredSlider.ngOnDestroy();
      this.featuredSlider.ngOnInit();
    });
    };

```

How to initializing the data and slider correctly? Thanks…

---

<div class="post-metadata">

**Author:** ![Sky9928](https://avatars.discourse-cdn.com/v4/letter/s/c77e96/32.png) [@Sky9928](https://forum.ionicframework.com/u/Sky9928)\
**Post date:** [June 14, 2016, 12:32pm UTC](https://forum.ionicframework.com/t/how-to-create-dynamic-slides/54772/2 "2016-06-14T12:32:41Z")

</div>

I have solve the problem. The bugs because the loop is true. So i disabled the loop and change method to this:

```
loadFeatured(){
    this.featuredService.loadFeatured()
    .then(dataFeatured => {
      this.featureds = null;
      this.featureds = dataFeatured;
      this.featuredSlider.update();
    });
    };
```
