Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 28 additions & 5 deletions app/scripts/app.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ angular.module('slick', [])
infinite: "@"
initialSlide: "@"
lazyLoad: "@"
mobileFirst: "@"
onBeforeChange: "&"
onAfterChange: "&"
onInit: "&"
Expand Down Expand Up @@ -72,8 +73,8 @@ angular.module('slick', [])
adaptiveHeight: scope.adaptiveHeight is "true"
arrows: scope.arrows isnt "false"
asNavFor: if scope.asNavFor then scope.asNavFor else undefined
appendArrows: if scope.appendArrows then $(scope.appendArrows) else $(element)
appendDots: if scope.appendDots then $(scope.appendDots) else $(element)
appendArrows: if scope.appendArrows then angular.element(scope.appendArrows) else angular.element(element)
appendDots: if scope.appendDots then angular.element(scope.appendDots) else angular.element(element)
autoplay: scope.autoplay is "true"
autoplaySpeed: if scope.autoplaySpeed? then parseInt(scope.autoplaySpeed, 10) else 3000
centerMode: scope.centerMode is "true"
Expand All @@ -85,8 +86,9 @@ angular.module('slick', [])
easing: scope.easing or "linear"
fade: scope.fade is "true"
focusOnSelect: scope.focusOnSelect is "true"
mobileFirst: scope.mobileFirst is "true"
infinite: scope.infinite isnt "false"
initialSlide:scope.initialSlide or 0
initialSlide: if scope.initialSlide? then parseInt(scope.initialSlide, 10) else 0
lazyLoad: scope.lazyLoad or "ondemand"
beforeChange: if attrs.onBeforeChange then scope.onBeforeChange else undefined
onReInit: if attrs.onReInit then scope.onReInit else undefined
Expand All @@ -105,15 +107,24 @@ angular.module('slick', [])
useCSS: scope.useCSS isnt "false"
variableWidth: scope.variableWidth is "true"
vertical: scope.vertical is "true"
prevArrow: if scope.prevArrow then $(scope.prevArrow) else undefined
nextArrow: if scope.nextArrow then $(scope.nextArrow) else undefined
prevArrow: if scope.prevArrow then angular.element(scope.prevArrow) else undefined
nextArrow: if scope.nextArrow then angular.element(scope.nextArrow) else undefined


slider.on 'init', (sl) ->
scope.onInit() if attrs.onInit
if currentIndex?
sl.slideHandler(currentIndex)

slider.on 'reInit', (sl) ->
scope.onReInit() if attrs.onReInit

slider.on 'setPosition', (sl) ->
scope.onSetPosition() if attrs.onSetPosition

slider.on 'swipe', (sl) ->
scope.onSwipe() if attrs.onSwipe

slider.on 'afterChange', (event, slick, currentSlide, nextSlide) ->
scope.onAfterChange() if scope.onAfterChange

Expand All @@ -123,6 +134,18 @@ angular.module('slick', [])
scope.currentIndex = currentSlide
)

slider.on 'beforeChange', (sl) ->
scope.onBeforeChange() if attrs.onBeforeChange

slider.on 'breakpoint', (sl) ->
scope.onBreakpoint() if attrs.onBreakpoint

slider.on 'destroy', (sl) ->
scope.onDestroy() if attrs.onDestroy

slider.on 'edge', (sl) ->
scope.onEdge() if attrs.onEdge

scope.$watch("currentIndex", (newVal, oldVal) ->
if currentIndex? and newVal? and newVal != currentIndex
slider.slick('slickGoTo', newVal)
Expand Down
4 changes: 2 additions & 2 deletions bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
"carousel"
],
"dependencies": {
"angular": "~1.3.0",
"slick-carousel": "~1.4.1"
"angular": ">=1.3.0",
"slick-carousel": "~1.5.5"
},
"author": {
"name": "Vasyl Stanislavchuk"
Expand Down
49 changes: 43 additions & 6 deletions dist/slick.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ angular.module('slick', []).directive('slick', [
infinite: '@',
initialSlide: '@',
lazyLoad: '@',
mobileFirst: '@',
onBeforeChange: '&',
onAfterChange: '&',
onInit: '&',
Expand Down Expand Up @@ -80,8 +81,8 @@ angular.module('slick', []).directive('slick', [
adaptiveHeight: scope.adaptiveHeight === 'true',
arrows: scope.arrows !== 'false',
asNavFor: scope.asNavFor ? scope.asNavFor : void 0,
appendArrows: scope.appendArrows ? $(scope.appendArrows) : $(element),
appendDots: scope.appendDots ? $(scope.appendDots) : $(element),
appendArrows: scope.appendArrows ? angular.element(scope.appendArrows) : angular.element(element),
appendDots: scope.appendDots ? angular.element(scope.appendDots) : angular.element(element),
autoplay: scope.autoplay === 'true',
autoplaySpeed: scope.autoplaySpeed != null ? parseInt(scope.autoplaySpeed, 10) : 3000,
centerMode: scope.centerMode === 'true',
Expand All @@ -93,8 +94,9 @@ angular.module('slick', []).directive('slick', [
easing: scope.easing || 'linear',
fade: scope.fade === 'true',
focusOnSelect: scope.focusOnSelect === 'true',
mobileFirst: scope.mobileFirst === 'true',
infinite: scope.infinite !== 'false',
initialSlide: scope.initialSlide || 0,
initialSlide: scope.initialSlide != null ? parseInt(scope.initialSlide, 10) : 0,
lazyLoad: scope.lazyLoad || 'ondemand',
beforeChange: attrs.onBeforeChange ? scope.onBeforeChange : void 0,
onReInit: attrs.onReInit ? scope.onReInit : void 0,
Expand All @@ -113,8 +115,8 @@ angular.module('slick', []).directive('slick', [
useCSS: scope.useCSS !== 'false',
variableWidth: scope.variableWidth === 'true',
vertical: scope.vertical === 'true',
prevArrow: scope.prevArrow ? $(scope.prevArrow) : void 0,
nextArrow: scope.nextArrow ? $(scope.nextArrow) : void 0
prevArrow: scope.prevArrow ? angular.element(scope.prevArrow) : void 0,
nextArrow: scope.nextArrow ? angular.element(scope.nextArrow) : void 0
});
slider.on('init', function (sl) {
if (attrs.onInit) {
Expand All @@ -124,6 +126,21 @@ angular.module('slick', []).directive('slick', [
return sl.slideHandler(currentIndex);
}
});
slider.on('reInit', function (sl) {
if (attrs.onReInit) {
return scope.onReInit();
}
});
slider.on('setPosition', function (sl) {
if (attrs.onSetPosition) {
return scope.onSetPosition();
}
});
slider.on('swipe', function (sl) {
if (attrs.onSwipe) {
return scope.onSwipe();
}
});
slider.on('afterChange', function (event, slick, currentSlide, nextSlide) {
if (scope.onAfterChange) {
scope.onAfterChange();
Expand All @@ -135,6 +152,26 @@ angular.module('slick', []).directive('slick', [
});
}
});
slider.on('beforeChange', function (sl) {
if (attrs.onBeforeChange) {
return scope.onBeforeChange();
}
});
slider.on('breakpoint', function (sl) {
if (attrs.onBreakpoint) {
return scope.onBreakpoint();
}
});
slider.on('destroy', function (sl) {
if (attrs.onDestroy) {
return scope.onDestroy();
}
});
slider.on('edge', function (sl) {
if (attrs.onEdge) {
return scope.onEdge();
}
});
return scope.$watch('currentIndex', function (newVal, oldVal) {
if (currentIndex != null && newVal != null && newVal !== currentIndex) {
return slider.slick('slickGoTo', newVal);
Expand All @@ -159,4 +196,4 @@ angular.module('slick', []).directive('slick', [
}
};
}
]);
]);
4 changes: 2 additions & 2 deletions dist/slick.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.