1

Hi I am using kenwheeler slick carousel but when I use ng-repeat on the div i get `listed images'.

What I a doing wrong here ?

<section class="regular slider" style="clear: both" ng-if="slides">
  <div ng-repeat="slide in slides">
    <img src="{{slide.path}}">
  </div>
</section>

I tried the solutions provided here angular slick although its different but still no proper images are being displayed. without ng-repeat it works perfect.

The output is something like this image

My controller

$scope.single_product = function (product_id) {
        $http.get('abc',
                {headers:
                            {'Content-Type': 'application/x-www-form-urlencoded',
                                'Authorization': $rootScope.keyword_auth_token}
                })
                .success(function (data) {
                    $scope.product = data;
                    $(".regular").slick({
                        dots: true,
                        infinite: true,
                        slidesToShow: 3,
                        slidesToScroll: 3,
                        autoplay: true,
                        autoplaySpeed: 2000
                    });
                })
                .error(function (data) {
                    console.log(data);
                });
    };

I am including slick.css slick-theme.css and slick.jshere is the link to all Files

12
  • can u give us a plunker Commented Dec 29, 2016 at 12:30
  • no error bro and I cant give you plunker man Commented Dec 29, 2016 at 12:30
  • You are able to get images but in a list right? Not side by side? Commented Dec 29, 2016 at 12:32
  • try ng-src = "{{slide.path}}" Commented Dec 29, 2016 at 12:32
  • Can u share some code which actually contains your controller? Commented Dec 29, 2016 at 12:33

5 Answers 5

2

Instead of src Use ng-src ng-src use to get the path of image in angularJS

Sign up to request clarification or add additional context in comments.

1 Comment

did it before no success
1

Go through this link carefully and apply styles http://kenwheeler.github.io/slick/

remove div that contains ng-repeat

<section class="regular slider" style="clear: both" ng-if="slides">
    <img ng-repeat="slide in slides" ng-src="{{slide.path}}">
</section>

4 Comments

I told in my question there is no css issue, I get listed images only when i apply ng repeat otherwise its perfecto
still the same output
Please include all styles.css and js source files that are related to slick
see the files please
0

Use ng-src

var app = angular.module("myApp", []);
app.controller('myCtrl', function($scope) {
  $scope.slides = [{
    path: 'https://cloud.githubusercontent.com/assets/1734769/3162502/f49ff416-eb35-11e3-8f47-3a85f8abfd84.png'
  }, {
    path: 'https://cloud.githubusercontent.com/assets/1734769/3162502/f49ff416-eb35-11e3-8f47-3a85f8abfd84.png'
  }, {
    path: 'https://cloud.githubusercontent.com/assets/1734769/3162502/f49ff416-eb35-11e3-8f47-3a85f8abfd84.png'
  }];
});
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script>
<div ng-app="myApp" ng-controller="myCtrl">
  <section class="regular slider" style="clear: both" ng-if="slides">
    <div ng-repeat="slide in slides">
      <img ng-src="{{slide.path}}">
    </div>
  </section>
</div>

Comments

0

Try this:

<div ng-repeat="slide in slides">
  <img ng-src="slide.path">
</div>

Comments

0

Check angular-slick README and include all css and js. Add slick to your angular.module [ let say MyApp ] dependency and use slick directives. I think you missed to use slick directives.

<section class="regular slider" style="clear: both" ng-if="slides">
  <slick slides-to-show=3 slides-to-scroll=3>
    <div ng-repeat="slide in slides">
      <img src="{{slide.path}}">
    </div>
  </slick>
</section>

1 Comment

I am not using angular js slick man i am using the slick which I have mentioned in my question

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.