I'm trying to create a carousel using ngu-carousel Angular module but I'm having trouble setting it up so that the carousel slides are dynamically generated from an array of objects. Based on the examples I've seen of this module in use, each slide must be set up with a <ng-template #first> inside of a container component which takes in the slides using the [dataSource] --> <ngu-carousel [dataSource]="[first, second, third]">.'
However, I can't seem to figure out how to set up that local reference to be uniquely generated so that I can create the slides with an ngFor, like this:
<ng-template ngFor let-item [ngForOf]="items" let-i="index" #dynamicReferenceNeededHere>
<p>{{item.title}}</p>
</ng-template>
Any help would be very much appreciated.
Now, your carousel is dynamic, it reads count of items from the
itemsarray in static.component.ts; I added another field to your array to show the possibility of using any number of fields in the dynamic carousel;use your existing stackblitz and change the contents of the 2 files as per the codes below:
make your static.component.ts to be:
make your static.component.html to be: