uiuniversal / ngu-carousel

Angular Universal carousel
https://ngu-carousel.netlify.app
MIT License
332 stars 105 forks source link

Carousel configuration update dynamically #405

Closed vm-hach closed 6 months ago

vm-hach commented 1 year ago

Hi, I need to update the touch property of my carousel configuration dynamically. Modifying the property of the configuration, or even cloning the configuration to put a new reference to the carousel has no effect. Modifying the property directly throught the ViewChild object gives the same result. What is very strange is that if I do it quite quickly after the view creation (<500ms), it is taken in account. If I do it after, it is not.

   public carouselTileConfig: NguCarouselConfig = {
      grid: { xs: 1, sm: 1, md: 1, lg: 1, all: 0 },
      slide: 3,
      speed: 250,
      point: {
         visible: true
      },
      load: 2,
      velocity: 0,
      touch: false,
      easing: 'cubic-bezier(0, 0, 0.2, 1)',
      loop: false
   };

   public slideSubject = new BehaviorSubject(true);

   ngOnInit() {
      this.slideSubject.subscribe(slide => {
         // this is well applied with the initial behavior subject value
         this.carouselTileConfig.touch = slide;
         this.carouselTileConfig = JSON.parse(JSON.stringify(this.carouselTileConfig));
         this.cdr.detectChanges();
      });

      // this has no effect !
      setTimeout(() => this.slideSubject.next(false), 2000);
   }

Is it a known bug? Is there any workaround? Thanks for your help,

santoshyadavdev commented 1 year ago

It looks like something we dont support currently, will check if we can support this.

github-actions[bot] commented 6 months ago

This issue has been automatically marked as stale because it has not had recent activity for 6 months. It will be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] commented 6 months ago

Closing this issue due to no activity for 6 months.