mihnsen / ui-carousel

A simple, lightweight module for carousel in your AngularJS app, Inspired from slick carousel.
http://mihnsen.github.io/ui-carousel/
MIT License
76 stars 66 forks source link

Using ui-carousel with ngRepeat #12

Closed isherwood closed 7 years ago

isherwood commented 7 years ago

I have a list of elements that are generated with ngRepeat. I can't figure out how to implement this. It seems like it would be a common scenario, but my slides' data isn't being passed to the children of the carousel-item directives.

Here's my original markup:

<content-card flex="50" flex-sm="33" flex-md="25" flex-gt-md="20" layout="column" ng-repeat="content in $ctrl.content" content="content"></content-card>

And here's what I'm trying to do:

<ui-carousel slides="$ctrl.content" slides-to-show="3" slides-to-scroll="1" initial-slide="1">
    <carousel-item>
        <content-card layout="column" content="item"></content-card>
    </carousel-item>
</ui-carousel>`

This throws an error because the 'content' attribute on the 'content-card' elements isn't being populated correctly.

mihnsen commented 7 years ago

Humm, I've create a pen http://codepen.io/mihnsen/pen/OmOLEQ and carousel still populated data to child element. You should take a look, thanks.

isherwood commented 7 years ago

Thank you. I've gone with Flickity as it suited my needs a bit better.

feleks247 commented 6 years ago

according to your example http://codepen.io/mihnsen/pen/OmOLEQ - how to start carousel automatically though when the page loads?