title: Angular directive is only loading part of jQuery plugin (pickadate) dynamically
body: <p>I have an ng-repeat rendering a directive, as the ng-repeat will be of unknown length I'm attempting to dynamically load a jquery plugin on click, via a directive.</p>
  
  <p>I believe I'm quite close, however, only part of the plugin loads, and unfortunately no errors are given. For those familiar with the <a href="http://amsul.ca/pickadate.js/" rel="nofollow">Pickadate</a> plugin, the classes are being rendered on the input element, however the elements that it appends dynamically are not being rendered on click.</p>
  
  <p>Here is my code:</p>
  
  <p><strong>HTML</strong></p>
  
  <pre><code>&lt;div class="calendar" add-calendar&gt;Click to add calendar&lt;/div&gt;
  </code></pre>
  
  <p><strong>Angular Directive 1</strong></p>
  
  <pre><code>agentApp.directive('addCalendar', ['$compile', function($compile) {
      return {
          restrict: 'A',
          link: function(scope, element, attrs) {
  
              template = '&lt;input type="text" jq-date-picker-range /&gt;';
  
              element.bind('click', function() {
                  angular.element(this).after($compile(template)(scope));
              });
          }
      }
  }]);
  </code></pre>
  
  <p><strong>Angular Directive 2</strong></p>
  
  <pre><code>agentApp.directive('jqDatePickerRange', function() {
      return {
          restrict: 'A',
          link: function(scope, element, attrs) {
            angular.element(element).pickadate();
          }
      };
  });
  </code></pre>
  
  <p><strong>Output</strong></p>
  
  <pre><code>&lt;input type="text" jq-date-picker-range class="ng-scope picker__input picker__input--active" readonly="" id="P780839543" aria-haspopup="true" aria-expanded="true" aria-readonly="false" aria-owns="P780839543_root"&gt;
  </code></pre>
  
  <p>As you can see, the classes are being written, but the calendar div elements which are rendered thereafter are not doing so.</p>
  
  <p>Any help is very much appreciated. Thanks.</p>