Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Carousel stuck/duplicates of same item #521

Open
La-kshya opened this issue Feb 6, 2025 · 0 comments
Open

Carousel stuck/duplicates of same item #521

La-kshya opened this issue Feb 6, 2025 · 0 comments
Labels

Comments

@La-kshya
Copy link

La-kshya commented Feb 6, 2025

If you change the carousel config i.e. the value to inputs in the carousel component the carousel will not update/have issues.
Also during migration from version 7.2 the *nguCarouselDef directive is not destroying items on change but I am having trouble reproducing it on your example applications. Either something changed that is not mentioned in breaking changes or I am messing something up. Would appreciate any help

To Reproduce

export class TileComponent {
  images = ['assets/bg.jpg', 'assets/car.png', 'assets/canberra.jpg', 'assets/holi.jpg'];

  public carouselItems = signal<string[]>([]);
  public carouselTileConfig: NguCarouselConfig = {
    grid: { xs: 1, sm: 1, md: 1, lg: 5, all: 0 },
    speed: 250,
    point: {
      visible: true
    },
    touch: true,
    loop: true,
  };

  constructor() {
    this.addItem();
    afterNextRender(() => {
      const id = setInterval(() => {
        this.addItem();
        if (this.carouselItems().length >= 30) {
          clearInterval(id);
        }
      }, 500);
    });

   setTimeout(()=>{
    this.carouselTileConfig={
      grid: { xs: 1, sm: 1, md: 1, lg: 1, all: 0 },
      slide:1,
      speed: 250,
    point: {
      visible: true
    },
    load:2,
    touch: true,
    loop: true,
    }
   },4000) ;
  }

  private addItem() {
    const i = Math.floor(Math.random() * this.images.length);
    this.carouselItems.update(items => [...items, this.images[i]]);
  }
}

@La-kshya La-kshya added the bug label Feb 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant