title: Updating date in Datepicker (Angular) when date in first datepicker is set after second datepicker
body: <p>I am using two datepickers</p>
  
  <pre><code>&lt;input type="text" class="form-control" datepicker-popup="{{format}}" ng-model="dt"
                       is-open="datepicker.dt" min-date="minDate" max-date="maxDate1" show-weeks="false" ng-required="true"
                       datepicker-options="dateOptions" show-button-bar="false"/&gt;
  </code></pre>
  
  <p>and </p>
  
  <pre><code>&lt;input type="text" class="form-control" datepicker-popup="{{format}}" ng-model="dt2"
                       is-open="datepicker.dt2" min-date="minDate" max-date="maxDate2" show-weeks="false" ng-required="true"
                        show-button-bar="false" /&gt;
  </code></pre>
  
  <p>I set the minDate to today and the dt and dt2 to 2 weeks and 3 weeks from today respectively. Now I want the second datepicker to depend on the first datepicker and vice versa. If the date of the second datepicker is chosen some time before the first date the date of the first datepicker should instantly change its date to the same day as chosen for the second datepicker. Also, if the date of the first datepicker is chosen after the second date, the second datepicker should change automatically to same day as the chosen date of the first datepicker. I thought about using a <code>$watch</code> function. But that does not seem to work.</p>
  
  <pre><code>$scope.dt=Datepicker.daysToAdd();
  </code></pre>
  
  <p>and in my service: </p>
  
  <pre><code>DateSettings.daysToAdd=function(){
          newDate = newDate.setDate(newDate.getDate()+numberOfDaysToAdd);
          return newDate;
      };
  </code></pre>
  
  <p>Analogously for the second datepicker.</p>
  
  <pre><code>$scope.$watch('dt',function(){
            if($scope.dt.getTime()&lt;=$scope.dt2.getTime()){
                Datepicker.daysToAdd();
            }else {
                $scope.dt2=$scope.dt;
            }
        });
  </code></pre>
  
  <p>How can I proceed from here as the $watch does not seem to do its job?!</p>