diff --git a/app/scripts/app.coffee b/app/scripts/app.coffee index f10dd50..67e8388 100644 --- a/app/scripts/app.coffee +++ b/app/scripts/app.coffee @@ -115,14 +115,15 @@ angular.module('slick', []) sl.slideHandler(currentIndex) slider.on 'afterChange', (event, slick, currentSlide, nextSlide) -> - scope.onAfterChange() if scope.onAfterChange - if currentIndex? scope.$apply(-> currentIndex = currentSlide scope.currentIndex = currentSlide ) + # call the onAfterChange after changing the scope + scope.onAfterChange() if scope.onAfterChange + scope.$watch("currentIndex", (newVal, oldVal) -> if currentIndex? and newVal? and newVal != currentIndex slider.slick('slickGoTo', newVal)