title: How to use owl-carousel in Angular2?
body: <p>I am new to Angular2 and was trying to convert owl-carousel in Angularjs to Angular2.</p>
  
  <p>Below is the index.html file for the owl-carousel implementation:</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html ng-app="plunker"&gt;
  
  &lt;head&gt;
  &lt;meta charset="utf-8" /&gt;
  &lt;title&gt;AngularJS Plunker&lt;/title&gt;
  &lt;script&gt;document.write('&lt;base href="' + document.location + '" /&gt;');&lt;/script&gt;
  &lt;link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/owl-carousel/1.3.3/owl.carousel.min.css" /&gt;
  &lt;link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/owl-carousel/1.3.3/owl.theme.min.css" /&gt;
  &lt;link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/owl-carousel/1.3.3/owl.transitions.min.css" /&gt;
  &lt;link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/owl-carousel/1.3.3/owl.carousel.min.js" /&gt;
  &lt;script data-require="angular.js@1.3.x" src="https://code.angularjs.org/1.3.15/angular.js" data-semver="1.3.15"&gt;&lt;/script&gt;
  &lt;script data-require="jquery@2.1.3" data-semver="2.1.3" src="http://code.jquery.com/jquery-2.1.3.min.js"&gt;&lt;/script&gt;
  &lt;script src="https://cdnjs.cloudflare.com/ajax/libs/owl-carousel/1.3.3/owl.carousel.min.js"&gt;&lt;/script&gt;
  &lt;script src="app.js"&gt;&lt;/script&gt;
  &lt;/head&gt;
  
  &lt;body ng-controller="MainCtrl"&gt;
  &lt;data-owl-carousel class="owl-carousel" data-options="{navigation: true, pagination: false, rewindNav : false}"&gt;
    &lt;div owl-carousel-item="" ng-repeat="item in ::items1" class="item"&gt;
      &lt;p&gt;{{::item}}&lt;/p&gt;
    &lt;/div&gt;
  &lt;/data-owl-carousel&gt;
   &lt;data-owl-carousel class="owl-carousel" data-options="{navigation: false, pagination: true, rewindNav : false}"&gt;
    &lt;div owl-carousel-item="" ng-repeat="item in ::items2" class="item"&gt;
      &lt;p&gt;{{::item}}&lt;/p&gt;
    &lt;/div&gt;
  &lt;/data-owl-carousel&gt;
  &lt;/body&gt;
  
  &lt;/html&gt;
  </code></pre>
  
  <p>Here is the app.js file:</p>
  
  <pre><code>var app = angular.module('plunker', []);
  
  app.controller('MainCtrl', function($scope) {
  $scope.items1 = [1,2,3,4,5];
  $scope.items2 = [1,2,3,4,5,6,7,8,9,10];
  }).directive("owlCarousel", function() {
  return {
      restrict: 'E',
      transclude: false,
      link: function (scope) {
          scope.initCarousel = function(element) {
            // provide any default options you want
              var defaultOptions = {
              };
              var customOptions = scope.$eval($(element).attr('data-options'));
              // combine the two options objects
              for(var key in customOptions) {
                  defaultOptions[key] = customOptions[key];
              }
              // init carousel
              $(element).owlCarousel(defaultOptions);
          };
      }
  };
  }).directive('owlCarouselItem', [function() {
  return {
      restrict: 'A',
      transclude: false,
      link: function(scope, element) {
        // wait for the last item in the ng-repeat then call init
          if(scope.$last) {
              scope.initCarousel(element.parent());
          }
      }
  };
  }]);
  </code></pre>
  
  <p>This is the Angular1 implementation how to implement it for Angular2?</p>