vasyabigi / angular-slick

Angular directive for slick-carousel
http://vasyabigi.github.io/angular-slick/
MIT License
500 stars 237 forks source link

AfterChange event wasn't triggered #169

Open mamzellejuu opened 7 years ago

mamzellejuu commented 7 years ago

The script never enter in

slider.on('afterChange', function (event, slick, currentSlide, nextSlide) {
       if (scope.onAfterChange) {
                scope.onAfterChange();
       }
       if (currentIndex != null) {
           return scope.$apply(function () {
               currentIndex = currentSlide;
               return scope.currentIndex = currentSlide;
           });
     }
});

The listener should be created before the slick plugin initialization. This will make sure that the event is not run before the listener created

Disorrder commented 7 years ago

isn't it fixed in version 1.6? Well, angular-slick uses

"dependencies": {
    "angular": "~1.3.0",
    "slick-carousel": "~1.4.1"
  },