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
77 stars 67 forks source link

Autoplay + add slides doesn't work #51

Open dengue8830 opened 6 years ago

dengue8830 commented 6 years ago

The cases in your examples works fine, but you have not an example for autoplay + add slides. So i dont know if i am doing something wrong :

scope.slides = [];
// fetch server data, add slides on callback
scope.slides.push(newSlides); // Slides are added to the view but doesn't autoplay until i click an arrow btn
<ui-carousel slides="slides" slides-to-show="3" slides-to-scroll="1" initial-slide="0" autoplay="true" autoplay-speed="2000" dots="false">
    <carousel-item>
        <div class="text-center">
            <img src="{{ item }}" alt="{{ item.nombre }}" style="max-height:100px;" />
        </div>
    </carousel-item>
</ui-carousel>

If i do something like this it works fine

scope.slides = ['url', 'url', 'url' , 'url'];

How can i trigger the autoplay manually after the data has been loaded asynchronously?