title: jQuery ui datepicker with Angularjs
body: <p>I want to use jQuery UI datepicker with AngularJS. </p>
  
  <p>I have a sample , but my code is not working.</p>
  
  <p>Sample:</p>
  
  <p><a href="http://www.abequar.net/jquery-ui-datepicker-with-angularjs/" rel="noreferrer">http://www.abequar.net/jquery-ui-datepicker-with-angularjs/</a></p>
  
  <p>My Code:</p>
  
  <pre><code>&lt;input id="sDate" name="programStartDate" type="text" datepicker required/&gt;
  
  
  
  angular.module('elnApp')
   .directive('datepicker', function () {
    return {
      restrict: 'A',
      require : 'ngModel',
      link : function (scope, element, attrs, ngModelCtrl) {
          $(function(){
              element.datepicker({
                  dateFormat:'yy-mm-dd',
                  onSelect:function (date) {
                      ngModelCtrl.$setViewValue(date);
                      scope.$apply();
  
                  }
              });
          });
      }
  } });
  </code></pre>
  
  <p>It shows an error <code>TypeError: Object [object Object] has no method 'datepicker'</code>.</p>