Last active
July 25, 2019 02:07
-
-
Save avtaniket/479b810e51e3e14a28509a66b82ec24e to your computer and use it in GitHub Desktop.
How to integrate Owl carousel with AngularJs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| index.html | |
| --------------------------------------------------------------------------------------------------------------------------- | |
| <link href="public/assets/owl_carousel/owl.carousel.css" rel="stylesheet"> | |
| <link href="public/assets/owl_carousel/owl.theme.css" rel="stylesheet"> | |
| <script src="public/assets/owl_carousel/owl.carousel.min.js"></script> | |
| <wrap-owlcarousel class="owl-carousel" data-options="owlOptionsTestimonials"> | |
| <div class="item">1</div> | |
| <div class="item">2</div> | |
| <div class="item">3</div> | |
| </wrap-owlcarousel> | |
| app.js | |
| --------------------------------------------------------------------------------------------------------------------------- | |
| app.controller('homeCtrl', ['$scope', 'appServ', 'toastr', '$routeParams', '$location', '$filter', | |
| function($scope, appServ, toastr, $routeParams, $location, $filter) { | |
| $scope.owlOptionsTestimonials = { | |
| autoPlay: 4000, | |
| stopOnHover: true, | |
| slideSpeed: 300, | |
| paginationSpeed: 600, | |
| items: 2 | |
| } | |
| } | |
| ]); | |
| app.directive('wrapOwlcarousel', function() { | |
| return { | |
| restrict: 'E', | |
| link: function(scope, element, attrs) { | |
| var options = scope.$eval($(element).attr('data-options')); | |
| $(element).owlCarousel(options); | |
| } | |
| }; | |
| }); |
it does not work with ng-repeat
Works OK for me. What's your code like?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
it does not work with ng-repeat