angular-owl-carousel2
Advanced tools
Comparing version 1.0.2 to 1.0.3
{ | ||
"name": "angular-owl-carousel2", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"description": "Owl carousel 2 imp for angularjs", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -19,4 +19,25 @@ # Angular Owl Carousel - 2 | ||
```js | ||
$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 () { | ||
console.dir(owlAPi); | ||
owlAPi.trigger('next.owl.carousel',[2000]); | ||
}, 2000) | ||
``` | ||
```html | ||
<ng-owl-carousel class="owl-theme" owl-items="items" owl-properties="properties"> | ||
<ng-owl-carousel class="owl-theme" owl-items="items" owl-properties="properties" owl-ready="ready($api)"> | ||
<div class="item"><h4>Free Item</h4></div> | ||
@@ -23,0 +44,0 @@ <div class="item" data-ng-repeat="item in items"><h4>{{$index}}</h4></div> |
@@ -9,2 +9,19 @@ /** | ||
function OwlController() { | ||
this.owlApi = {}; | ||
} | ||
OwlController.prototype.init = function () { | ||
this.owlApi = arguments[0]; | ||
}; | ||
OwlController.prototype.getApi = function () { | ||
var self = this; | ||
return { | ||
trigger: function () { | ||
self.owlApi.trigger.apply(self.owlApi, arguments); | ||
} | ||
} | ||
}; | ||
var owlProperties = [ | ||
@@ -107,6 +124,7 @@ //OPTIONS | ||
}, | ||
controller: OwlController, | ||
transclude: true, | ||
template: '<div class="owl-carousel" data-ng-transclude></div>' | ||
}; | ||
function link($scope, $element, $attr) { | ||
function link($scope, $element, $attr, owlCtrl) { | ||
var options = {}, | ||
@@ -156,4 +174,5 @@ initial = true, | ||
owlCarousel = $element.find(owlCarouselClassName).owlCarousel(options); | ||
owlCtrl.init(owlCarousel); | ||
if (angular.isDefined($scope.owlReady)) { | ||
$scope.owlReady({$api: owlCarousel}); | ||
$scope.owlReady({$api: owlCtrl.getApi()}); | ||
} | ||
@@ -160,0 +179,0 @@ }); |
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
9363
213
47