AngularJS Example:

by Alexey Ryazhskikh

HTML

<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.9.0/moment.min.js"></script>
<div ng-app="project">
 
  <div ng-controller="ListCtrl" >
      <div>
          <input type="date" ng-model="startDate" /> <br/>
          <input type="date" ng-model="endDate" my-directive="startDate" min="{{toDate(startDate)}}"/> <br/>

      </div>
      <div>
          {{startDate | json}}
      </div>
  </div>
</div>

CSS

</style> <!-- Ugly Hack due to jsFiddle issue: http://goo.gl/BUfGZ --> 
<link rel="stylesheet" href="http://netdna.bootstrapcdn.com/bootstrap/3.0.3/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js"></script>
<script scr="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.9.0/moment.min.js"></script>

<style>

JavaScript

angular.module('project', [])


.controller('ListCtrl', function($scope) {
    $scope.toDate = function(val) {
        if (!val) {
            return undefined;
        }
       
        var result =  moment(val).format("YYYY-MM-DD"); 
        console.log(result);
        return result;
    }
})

.directive("myDirective", function(){
   return {
      require: 'ngModel',
       scope: {
           minValue: "=myDirective"
       },
      link: function(scope, element, attrs) {
          scope.$watch('minValue', function(){
              console.log(scope.minValue);
          });
      }
    };
});