Skip to content

Commit eb1eeb5

Browse files
author
Mark
committed
- added attribute
1 parent f8c0547 commit eb1eeb5

4 files changed

Lines changed: 188 additions & 38 deletions

File tree

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "angular-slick-carousel",
3-
"version": "3.0.6",
3+
"version": "3.0.7",
44
"homepage": "https://github.com/devmark/angular-slick-carousel",
55
"authors": [
66
"DevMark <hc.devmark@gmail.com>",

dist/angular-slick.js

Lines changed: 93 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* angular-slick-carousel
33
* DevMark <hc.devmark@gmail.com>,Karan Batra-Daitch <karanganesha04@gmail.com>
44
* https://github.com/devmark/angular-slick-carousel
5-
* Version: 3.0.6 - 2015-07-29T09:37:30.313Z
5+
* Version: 3.0.7 - 2015-08-01T16:11:26.568Z
66
* License: MIT
77
*/
88

@@ -13,36 +13,112 @@ angular
1313
.module('slickCarousel', [])
1414
//global config
1515
.constant('slickCarouselConfig', {
16-
autoplay: true,
17-
dots: true,
18-
autoplaySpeed: 3000,
19-
lazyLoad: 'ondemand',
2016
method: {},
2117
event: {}
2218
})
2319
.directive('slick', [
2420
'$timeout', 'slickCarouselConfig', function ($timeout, slickCarouselConfig) {
25-
var slickOptionList, slickMethodList, slickEventList;
26-
slickOptionList = ['accessibility', 'adaptiveHeight', 'autoplay', 'autoplaySpeed', 'asNavFor', 'appendArrows', 'prevArrow', 'nextArrow', 'centerMode', 'centerPadding', 'cssEase', 'customPaging', 'dots', 'draggable', 'fade', 'focusOnSelect', 'edgeFriction', 'infinite', 'initialSlide', 'lazyLoad', 'mobileFirst', 'pauseOnHover', 'pauseOnDotsHover', 'respondTo', 'rows', 'slide', 'slidesPerRow', 'slidesToShow', 'slidesToScroll', 'speed', 'swipe', 'swipeToSlide', 'touchMove', 'touchThreshold', 'useCSS', 'variableWidth', 'vertical', 'verticalSwiping', 'rtl'];
21+
var slickMethodList, slickEventList;
2722
slickMethodList = ['slickGoTo', 'slickNext', 'slickPrev', 'slickPause', 'slickPlay', 'slickAdd', 'slickRemove', 'slickFilter', 'slickUnfilter', 'unslick'];
2823
slickEventList = ['afterChange', 'beforeChange', 'breakpoint', 'destroy', 'edge', 'init', 'reInit', 'setPosition', 'swipe'];
2924

3025
return {
3126
scope: {
3227
settings: '=',
33-
data: '='
28+
data: '=',
29+
accessibility: '@',
30+
adaptiveHeight: '@',
31+
autoplay: '@',
32+
autoplaySpeed: '@',
33+
arrows: '@',
34+
asNavFor: '@',
35+
appendArrows: '@',
36+
prevArrow: '@',
37+
nextArrow: '@',
38+
centerMode: '@',
39+
centerPadding: '@',
40+
cssEase: '@',
41+
customPaging: '&',
42+
dots: '@',
43+
draggable: '@',
44+
fade: '@',
45+
focusOnSelect: '@',
46+
easing: '@',
47+
edgeFriction: '@',
48+
infinite: '@',
49+
initialSlide: '@',
50+
lazyLoad: '@',
51+
mobileFirst: '@',
52+
pauseOnHover: '@',
53+
pauseOnDotsHover: '@',
54+
respondTo: '@',
55+
responsive: '=?',
56+
rows: '@',
57+
slide: '@',
58+
slidesPerRow: '@',
59+
slidesToShow: '@',
60+
slidesToScroll: '@',
61+
speed: '@',
62+
swipe: '@',
63+
swipeToSlide: '@',
64+
touchMove: '@',
65+
touchThreshold: '@',
66+
useCSS: '@',
67+
variableWidth: '@',
68+
vertical: '@',
69+
verticalSwiping: '@',
70+
rtl: '@'
3471
},
3572
restrict: 'AE',
3673
link: function (scope, element, attr) {
3774
var options, initOptions, destroy, init, destroyAndInit, currentIndex = 0;
3875

3976
initOptions = function () {
40-
options = angular.extend(angular.copy(slickCarouselConfig), scope.settings);
41-
angular.forEach(attr, function (value, key) {
42-
if (slickOptionList.indexOf(key) !== -1) {
43-
options[key] = scope.$eval(value);
44-
}
45-
});
77+
options = angular.extend(angular.copy(slickCarouselConfig), {
78+
accessibility: scope.accessibility !== 'false',
79+
adaptiveHeight: scope.adaptiveHeight === 'true',
80+
autoplay: scope.autoplay === 'true',
81+
autoplaySpeed: scope.autoplaySpeed != null ? parseInt(scope.autoplaySpeed, 10) : 3000,
82+
arrows: scope.arrows !== 'false',
83+
asNavFor: scope.asNavFor ? scope.asNavFor : void 0,
84+
appendArrows: scope.appendArrows ? $(scope.appendArrows) : $(element),
85+
prevArrow: scope.prevArrow ? $(scope.prevArrow) : void 0,
86+
nextArrow: scope.nextArrow ? $(scope.nextArrow) : void 0,
87+
centerMode: scope.centerMode === 'true',
88+
centerPadding: scope.centerPadding || '50px',
89+
cssEase: scope.cssEase || 'ease',
90+
customPaging: attr.customPaging ? customPaging : void 0,
91+
dots: scope.dots === 'true',
92+
draggable: scope.draggable !== 'false',
93+
fade: scope.fade === 'true',
94+
focusOnSelect: scope.focusOnSelect === 'true',
95+
easing: scope.easing || 'linear',
96+
edgeFriction: scope.edgeFriction || 0.15,
97+
infinite: scope.infinite !== 'false',
98+
initialSlide: scope.initialSlide || 0,
99+
lazyLoad: scope.lazyLoad || 'ondemand',
100+
mobileFirst: scope.mobileFirst === 'true',
101+
pauseOnHover: scope.pauseOnHover !== 'false',
102+
pauseOnDotsHover: scope.pauseOnDotsHover === "true",
103+
respondTo: scope.respondTo != null ? scope.respondTo : 'window',
104+
responsive: scope.responsive || void 0,
105+
rows: scope.rows != null ? parseInt(scope.rows, 10) : 1,
106+
slide: scope.slide || 'div',
107+
slidesPerRow: scope.slidesPerRow != null ? parseInt(scope.slidesPerRow, 10) : 1,
108+
slidesToShow: scope.slidesToShow != null ? parseInt(scope.slidesToShow, 10) : 1,
109+
slidesToScroll: scope.slidesToScroll != null ? parseInt(scope.slidesToScroll, 10) : 1,
110+
speed: scope.speed != null ? parseInt(scope.speed, 10) : 300,
111+
swipe: scope.swipe !== 'false',
112+
swipeToSlide: scope.swipeToSlide === 'true',
113+
touchMove: scope.touchMove !== 'false',
114+
touchThreshold: scope.touchThreshold ? parseInt(scope.touchThreshold, 10) : 5,
115+
useCSS: scope.useCSS !== 'false',
116+
variableWidth: scope.variableWidth === 'true',
117+
vertical: scope.vertical === 'true',
118+
verticalSwiping: scope.verticalSwiping === 'true',
119+
rtl: scope.rtl === 'true'
120+
}, scope.settings);
121+
46122
};
47123

48124
destroy = function () {
@@ -62,7 +138,6 @@ angular
62138
} else {
63139
slickness.slick(options);
64140
}
65-
66141
scope.internalControl = options.method || {};
67142

68143
// Method
@@ -142,10 +217,10 @@ angular
142217
}, 1);
143218
};
144219

145-
scope.$on('$destroy', function() {
146-
destroy();
220+
scope.$on('$destroy', function () {
221+
destroy();
147222
});
148-
223+
149224
scope.$watch('settings', function (newVal, oldVal) {
150225
if (newVal !== null) {
151226
return destroyAndInit();

dist/angular-slick.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)