I'm trying to get owl carousel to work in Angular.
I want to markup like this in my view, since I have many galleries :
<owl-carousel owl-options="owlOptions">
<div ng-repeat="image in gallery" class="item">
<p>hello</p>
</div>
</owl-carousel>
Basically all the directive should be doing is initalizing the carousel. The directive works perfectly, unless I use an ng-repeat. I'm guessing the directive is loading before the ng-repeat is being processed.
Does anyone have any ideas on how to solve this without building templates and directives for every style of slider?
Thank you so much!
Here is the directive:
angular.module('dir.owlCarousel', [])
.directive('owlCarousel',[function() {
return {
restrict: 'EA',
transclude: false,
scope: {
owlOptions: '='
},
link: function(scope, element, attrs) {
$(element).owlCarousel(scope.owlOptions);
}
};
}]);
You want to take a look at these answer:
ng-repeat finish event
AngularJS event for when model binding or ng-repeat is complete?
Had to make some changes to your directive so it would work with multiple carousels on the same page. Here is a link to a working plnkr
Here is the HTML