title: How to use the linked pickers in angular-eonasdan-datetimepicker?
body: <p>I am using angular-eonasdan-datetimepicker, an angular wrapper for eonasdan-datetimepicker. How to keep the end date always greater than start date. Also disable the previous dates till start date in end date calendar.</p>
  
  <p>I tried with on-change event to update the UI but its not happening. The event is getting called but the value in not updating.</p>
  
  <p>Inside the onchange event of end date:</p>
  
  <p>$scope.FormName.enddate = $scope.startdate;</p>
  
  <p>i.e.</p>
  
  <p>(FormName.elementName) = userselected value of start date from model.</p>
  
  <p>In jquery it uses :</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
      $(function () {
          $('#datetimepicker6').datetimepicker();
          $('#datetimepicker7').datetimepicker({
              useCurrent: false //Important! See issue #1075
          });
          $("#datetimepicker6").on("dp.change", function (e) {
              $('#datetimepicker7').data("DateTimePicker").minDate(e.date);
          });
          $("#datetimepicker7").on("dp.change", function (e) {
              $('#datetimepicker6').data("DateTimePicker").maxDate(e.date);
          });
      });
  &lt;/script&gt;
  </code></pre>
  
  <p>the angular wrapper code look like this : </p>
  
  <pre><code>(function() {
    'use strict';
  
    var module = angular.module('ae-datetimepicker', []);
  
    module.directive('datetimepicker', [
        '$timeout',
        function($timeout) {
          return {
            require: '?ngModel',
            restrict: 'EA',
            scope: {
              options: '@',
              onChange: '&amp;',
              onClick: '&amp;'
            },
            link: function($scope, $element, $attrs, controller) {
              $element.on('dp.change', function() {
                $timeout(function() {
                  var dtp = $element.data('DateTimePicker');
                  controller.$setViewValue(dtp.date());
                  $scope.onChange();
                });
              });
  
              $element.on('click', function() {
                $scope.onClick();
              });
  
              controller.$render = function () {
                if (!!controller) {
                  if (controller.$viewValue === undefined) {
                    controller.$viewValue = null;
                  }
                  else if (!(controller.$viewValue instanceof moment)) {
                    controller.$viewValue = moment(controller.$viewValue);
                  }
                  $element.data('DateTimePicker').date(controller.$viewValue);
                }
              };
  
  
              $element.datetimepicker($scope.$eval($attrs.options));
            }
          };
        }
      ]);
  })();
  </code></pre>
  
  <p>Any lead will be very helpful.</p>