How to create dynamic slides


#1

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…


#2

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();
    });
    };