title: Problems with ng-repeat and ajax-loaded content in directive
body: <p>I'm creating some directive that wraps up jCarousel plugin. But content for it loading dynamically via ajax.</p>
  
  <p>So here are examples of my code:</p>
  
  <p><strong>Calling directive in HTML:</strong></p>
  
  <pre><code>&lt;div class="jcarousel" dates-carousel dates="dates"&gt;&lt;/div&gt;
  </code></pre>
  
  <p>where <code>dates</code> - dynamically loaded array via ajax by one of my services</p>
  
  <p><strong>Directive</strong></p>
  
  <pre><code>datesCarouselDirective = function() {
    return {
      restrict: "A",
      scope: {
        dates: "="
      },
      templateUrl: "...",
      link: function($scope, $element, $attrs) {
        var jcarousel = $element;
        jcarousel.on("jcarousel:reload jcarousel:create", function() {
          var width;
          width = jcarousel.innerWidth() / 3;
          return jcarousel.jcarousel("items").css("width", width + "px");
        }).jcarousel({
          wrap: "null"
        });
        $element.find(".jcarousel-control-prev").jcarouselControl({
          target: "-=1"
        });
        $element.find(".jcarousel-control-next").jcarouselControl({
          target: "+=1"
        });
  
        console.log($scope.dates); // returns []
        console.log($scope.dates.length);  // returns 0
      }
    };
  };
  </code></pre>
  
  <p><strong>Directive template:</strong></p>
  
  <pre><code>&lt;ul&gt;
    &lt;li&gt;(ng-repeat="date in dates")
      {{date.format("MMM D")}}
    &lt;/li&gt;
  &lt;/ul&gt;
  &lt;a class="jcarousel-control-prev"&gt;
    &lt;i class="fa fa-angle-left"&gt;&lt;/i&gt;
  &lt;/a&gt;
  &lt;a class="jcarousel-control-next"&gt;
    &lt;i class="fa fa-angle-right"&gt;&lt;/i&gt;
  &lt;/a&gt;
  </code></pre>
  
  <p>So because of <code>dates</code> inside directive equals <code>[]</code> (it seems to me that ajax loads dates later than directive becomes rendering) my jCarusel is not working properly. Could somebody help me with this issue and tell how to make my directive work properly and maybe to refactor my directive if needed?</p>