Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ng-repeat with slick js carousel

Tags:

angularjs

I'm new to angularjs and I have a hard time working with ng-repeat for js plugins like https://github.com/vasyabigi/angular-slick and some other js modules (banner...)

  <slick class="slider lazy">
   <div ng-repeat="slide in slides"><div class="image"><img data-lazy="http://vasyabigi.github.io/angular-slick/images/lazyfonz2.png"/></div></div>
</slick

     <slick class="slider lazy">
       <div><div class="image"><img data-lazy="..."/></div></div>
        <div><div class="image"><img data-lazy="..."/></div></div>...  >> without ng-repeat, it works
    </slick

Maybe there's not enough time to wait for all images finish rendering before the slickJs takes action.

The directive does have $timeout (https://github.com/vasyabigi/angular-slick/blob/master/dist/slick.js) though.

like image 398
nam vo Avatar asked Dec 05 '25 12:12

nam vo


1 Answers

Seems to work without issues.

Plunker Demo

Maybe you can show the code in your src, not the result?

html:

<slick autoplay="true" autoplaySpeed="500" fade="true">
  <div ng-repeat="image in images">
    <img data-lazy="{{image}}">
  </div>
</slick>

controller:

var app = angular.module('demo',['slick']);

app.controller('Ctrl', function($scope) {
  $scope.images = [
    "http://vasyabigi.github.io/angular-slick/images/lazyfonz1.png",
    "http://vasyabigi.github.io/angular-slick/images/lazyfonz2.png",
    "http://vasyabigi.github.io/angular-slick/images/lazyfonz3.png",
    ];
});
like image 150
Max Fichtelmann Avatar answered Dec 07 '25 03:12

Max Fichtelmann



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!