title: How to disable dates using angular moment picker dynamically
body: <p>I use angular moment picker. I wanted some dates disable dynamically from database.I use <em>selectable</em> Method but it works after the date selected. Anyone can help Me to disable date dynamically ?</p>
  
  <p>view</p>
  
  <pre><code>&lt;div class="col-md-2" &gt;
      &lt;div class="form-control" start-view="month" id="stringDate"  moment-picker="stringDate"   
       format="DD-MM-YYYY" locale="en" name="pickdate" ng-model="momentDate" 
      selectable="dateDisable(date,type)" required&gt;
      &lt;a class="pull-right" ng-if="stringDate"   ng-click="stringDate = ''"&gt;  &amp;times; &lt;/a&gt;
      &lt;span ng-class="{'text-muted': stringDate}"&gt;
          {{stringDate || 'Select a date...' }}
      &lt;/span&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p> 
  View Controller</p>
  
  <pre><code>$scope.dateDisable = function(date,type)
  {
      var check = 0;
      for(var i=0;i&lt;=$scope.leavedates.length;i++) {
          var disable = $scope.leavedates[i].Date_selected;
          check = type !== 'day' || date.format('DD-MM-YYYY') !== disable;
          if(!check)  {
              return false;
          }
  
      }
  };
  $scope.leavedates =[];
  $scope.getDatesSelect_asleave = function()
  {
      $http.post('url').success(function(response) {
      $scope.leavedates =response;
  
  
      });
  }; 
  </code></pre>