title: How to dynamically set properties for AngularJS jQueryUI datepicker directive
body: <p>I have a need to set the min Date for one of my datepicker inputs to 5 days after today's date.  I have setup the jQueryUI datepicker directive for AngularJS, and by itself, it works great.  When I try to add any properties to the input for an individual datepicker, such as 'min' (Date), it does not appear to honor the property, and shows me all dates.</p>
  
  <p>sorry for not having a jsfiddle or plunker</p>
  
  <p>EDIT: Updated to show solution</p>
  
  <p>index.html</p>
  
  <pre><code>&lt;input id="requestDate" type="text" ng-model="requestDate" ss-datepicker min-date="5"/&gt;
  </code></pre>
  
  <p>Datepicker.js</p>
  
  <pre><code>app.directive('ssDatepicker', function(){
      return {
          restrict: 'A',
          require: 'ngModel',
          link: function(scope, element, attrs, ngModelCtrl){
              $(function(){
                  element.datepicker({
                      dateFormat:'dd-M-yy',
                      showOn: 'both',
                      buttonImage: "/e/images/calendar-ui.gif",
                      buttonImageOnly: true,
                      buttonText:'Choose a Date',
          beforeShow: function(element, datepicker){
              if(attrs.minDate){
                              angular.element(element).datepicker("option", "minDate", attrs.minDate);
              }
              if(attrs.maxDate){
                              angular.element(element).datepicker("option", "maxDate", attrs.maxDate);
              }
          },
                      onSelect:function(date){
                          scope.$apply(function(){
                              ngModelCtrl.$setViewValue(date);
                          });
                      }
                  });
              });
          }
      }
  });
  </code></pre>
  
  <p>Thanks in advance!</p>