angular-owl-carousel2
Advanced tools
Comparing version 1.0.4 to 1.0.5
{ | ||
"name": "angular-owl-carousel2", | ||
"version": "1.0.4", | ||
"version": "1.0.5", | ||
"description": "Owl carousel 2 imp for angularjs", | ||
@@ -5,0 +5,0 @@ "main": "src/angular-owl-carousel-2.js", |
@@ -40,2 +40,3 @@ /** | ||
'autoWidth', | ||
'autoHeight', //see https://github.com/emalikterzi/angular-owl-carousel-2/issues/4 | ||
'startPosition', | ||
@@ -69,4 +70,7 @@ 'URLhashListener', | ||
'videoWidth', | ||
'animateIn', | ||
'animateInClass', | ||
'animateOutClass', | ||
'animateOut', | ||
'animateInClass', | ||
'fallbackEasing', | ||
@@ -116,3 +120,3 @@ 'info', | ||
app.directive('ngOwlCarousel', ['$timeout', function ($timeout) { | ||
app.directive('ngOwlCarousel', ['$timeout', '$log', function ($timeout, $log) { | ||
return { | ||
@@ -131,17 +135,10 @@ restrict: 'E', | ||
function link($scope, $element, $attr, owlCtrl) { | ||
var options = {}, | ||
var options = buildProperties($scope.owlProperties), | ||
initial = true, | ||
owlCarouselClassName = '.owl-carousel', | ||
owlCarousel = null, | ||
propertyName = $attr.owlItems; | ||
owlCarousel = null; | ||
if (!propertyName) | ||
throw 'owl-items attribute cannot be null'; | ||
$scope.$watchCollection('owlItems', function (items) { | ||
$scope.$watch('[owlItems,owlProperties]', function (arr) { | ||
var items = arr[0]; | ||
var props = arr[1]; | ||
if ((items && items.length > 0 && !initial)) { | ||
buildProperties(props); | ||
destroyOwl(); | ||
@@ -151,4 +148,4 @@ initOwl(); | ||
else if ((items && items.length > 0 && initial)) { | ||
buildProperties(props); | ||
init(); | ||
initial = false; | ||
initOwl(); | ||
} | ||
@@ -158,16 +155,15 @@ | ||
function init() { | ||
initial = false; | ||
initOwl(); | ||
} | ||
function buildProperties(props) { | ||
var build = {}; | ||
if (props) { | ||
options = {}; | ||
owlProperties.forEach(function (each) { | ||
if (angular.isDefined(props[each])) { | ||
options[each] = props[each]; | ||
for (var key in props) { | ||
if (owlProperties.indexOf(key) >= 0) { | ||
build[key] = props[key]; | ||
} else { | ||
$log.warn('unknown property : ' + key); | ||
} | ||
}) | ||
} | ||
} | ||
return build; | ||
} | ||
@@ -174,0 +170,0 @@ |
@@ -8,9 +8,11 @@ /** | ||
var owlAPi; | ||
$scope.items = [1, 2, 3, 4, 5, 6, 7, 8]; | ||
$scope.items = [1, 2, 3, 4, 5, 6, 7, 8, 10]; | ||
$scope.properties = { | ||
items: 2, | ||
onChange: function () { | ||
console.dir(arguments); | ||
} | ||
// autoHeight:true, | ||
animateIn: 'fadeIn', | ||
lazyLoad: true, | ||
items: 5, | ||
margin: 10 | ||
}; | ||
@@ -21,8 +23,8 @@ | ||
}; | ||
$timeout(function () { | ||
console.dir(owlAPi); | ||
owlAPi.trigger('next.owl.carousel',[2000]); | ||
}, 2000) | ||
$scope.items.push(11); | ||
},2000) | ||
}); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
73864
19
209