I'm using a carousel called flickity
when I'm using static data the carousel works normally
normal behavior code:
<div class="carousel" data-flickity='{"autoPlay": "10000", "wrapAround": true, "imagesLoaded": true}'> <a href=""> <img class="carousel-cell" src="https://149634564.v2.pressablecdn.com/wp-content/uploads/2021/08/rober-gonzalez-ShXbeohihGo-unsplash-800x550.jpg" alt=""> </a> <a href=""> <img class="carousel-cell" src="https://149634564.v2.pressablecdn.com/wp-content/uploads/2021/08/niklas-veenhuis-TEjATSCI2A4-unsplash-800x550.jpg" alt=""> </a> </div>
but when I request data then use *ngfor it shows all slides as one block, no sliding.
not working code:
<div class="carousel cssanimation sequence fadeInBottom" #carousel data-flickity='{"autoPlay": "10000", "wrapAround": true, "imagesLoaded": true}'> <a href="" *ngFor="let show of RecentReleases"> <img class="carousel-cell" [src]="show.largePoster" alt="poster"> </a> </div>
my ts code:
RecentReleases?: IShow[]; ngOnInit(): void { this.homeService.getRecentReleases().subscribe((shows) => { this.RecentReleases = shows; }); }
Does anyone know how to solve this?
-Edit 1: when I initialized the "RecentRleleases" with a static data it worked correctly so I think the problem in waiting the data ?