angular-slick-carousel icon indicating copy to clipboard operation
angular-slick-carousel copied to clipboard

How to get current slide index?

Open supermarioim opened this issue 9 years ago • 1 comments

As I can see there is method slickCurrentSlide in original slick methods, but it's not ported...

supermarioim avatar Sep 20 '16 22:09 supermarioim

@supermarioim https://github.com/devmark/angular-slick-carousel#faq

Q: After change data, could i keep the current slide index? A: For this directive, this will destroy and init slick when updating data. You could get current index by event. example:

    $scope.currentIndex = 0;
    $scope.slickConfig = {
        event: {
            afterChange: function (event, slick, currentSlide, nextSlide) {
              $scope.currentIndex = currentSlide; // save current index each time
            }
            init: function (event, slick) {
              slick.slickGoTo($scope.currentIndex); // slide to correct index when init
            }
        }
    };

what's your problem with that?

kukac7 avatar Sep 27 '16 09:09 kukac7