angular-owl-carousel2
Advanced tools
Comparing version 1.0.1 to 1.0.2
{ | ||
"name": "angular-owl-carousel2", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "Owl carousel 2 imp for angularjs", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -8,2 +8,3 @@ /** | ||
(function (app) { | ||
var owlProperties = [ | ||
@@ -97,16 +98,2 @@ //OPTIONS | ||
// ONLY TRIGGERABLE EVENTS | ||
var owlEvents = [ | ||
'refresh.owl.carousel', | ||
'next.owl.carousel', | ||
'prev.owl.carousel', | ||
'to.owl.carousel', | ||
'destroy.owl.carousel', | ||
'replace.owl.carousel', | ||
'add.owl.carousel', | ||
'remove.owl.carousel', | ||
'play.owl.autoplay', | ||
'stop.owl.autoplay' | ||
]; | ||
app.directive('ngOwlCarousel', ['$timeout', function ($timeout) { | ||
@@ -119,3 +106,3 @@ return { | ||
owlProperties: '=', | ||
owlCtrl: '=' | ||
owlReady: '&' | ||
}, | ||
@@ -135,4 +122,2 @@ transclude: true, | ||
$scope.owlCtrl = new OwlCtrl(); | ||
$scope.$watch('[owlItems,owlProperties]', function (arr) { | ||
@@ -173,2 +158,5 @@ var items = arr[0]; | ||
owlCarousel = $element.find(owlCarouselClassName).owlCarousel(options); | ||
if (angular.isDefined($scope.owlReady)) { | ||
$scope.owlReady({$api: owlCarousel}); | ||
} | ||
}); | ||
@@ -180,17 +168,4 @@ } | ||
} | ||
function OwlCtrl() { | ||
this.isOwlCtrl = true; | ||
} | ||
OwlCtrl.prototype.triggerEvent = function triggerEvent(event) { | ||
if (owlEvents.indexOf(event) > -1) { | ||
owlCarousel.trigger(event); | ||
} | ||
}; | ||
OwlCtrl.prototype.getOwl = function returnOwl() { | ||
return owlCarousel; | ||
}; | ||
} | ||
}]); | ||
})(angularApp); |
@@ -7,10 +7,21 @@ /** | ||
app.controller('TestController', function ($scope, $timeout) { | ||
var owlAPi; | ||
$scope.items = [1, 2, 3, 4, 5, 6, 7, 8]; | ||
$scope.properties = { | ||
items: 2, | ||
onChange: function () { | ||
console.dir(arguments); | ||
} | ||
}; | ||
$scope.ready = function ($api) { | ||
owlAPi = $api; | ||
}; | ||
$timeout(function () { | ||
$scope.properties = {items: 2} | ||
}, 1000) | ||
console.dir(owlAPi); | ||
owlAPi.trigger('next.owl.carousel',[2000]); | ||
}, 2000) | ||
}); |
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
8482
197