title: Angular input validation with optional max min always invalid
body: <p>I am building a directive that adds some logic to the input['date'] element. This is what I have right now:</p>
  
  <pre><code>app.directive('calendarInput', function() {
      'use strict';
      return {
          template : '&lt;input type="date"' +
                              'ng-model="calendarInput"' +
                              'min="{{min}}"' +
                              'max="{{max}}" /&gt;'
          replace: true,
          scope: {
              startdate : '@',
              enddate : '@',
              calendarInput: '='
          },
          restrict: 'A',
          link: function (scope, element, attrs) {
              scope.$watch('startdate', function (val) {
                  if (val) {
                      var date = new Date(val);
                      scope.min = date.toIsoString().split('T')[0];
                  }
              });
              scope.$watch('enddate', function (val) {
                  if (val) {
                      var date = new Date(val);
                      scope.max = date.toIsoString().split('T')[0];
                  }
              });
          }
      };
  });
  </code></pre>
  
  <p>The idea is to reuse this directive. Sometimes there will be a startdate only, sometimes a enddate only. Like so:</p>
  
  <pre><code>&lt;div calendar-input="item.birthday" enddate="'1990-01-01'"&gt;&lt;/div&gt;
  </code></pre>
  
  <p>Unfortunately this always results in an invalid form with the class <code>ng-invalid-min</code>. It's because I don't supply the startdate parameter. </p>
  
  <p><strong>How can I make min or max values optional?</strong></p>
  
  <p>Edit:
  I am using Angular 1.3.9</p>