2016-09-26 14 views
0

私は自分のプロジェクトにangle js datepickerを注入しようとしています。私はドキュメンテーションに従ってやっています。表示される日付ピッカーには何も表示されません。 私はplnkr plnkrAngular Datepicker minDateとmaxDateが機能していません

<!DOCTYPE html> 
<html ng-app="plunker"> 

    <head> 
    <meta charset="utf-8" /> 
    <title>AngularJS Plunker</title> 
    <script>document.write('<base href="' + document.location + '" />');</script> 
    <link rel="stylesheet" href="style.css" /> 
    <link rel="stylesheet" href="https://rawgit.com/g00fy-/angular-datepicker/master/app/styles/bootstrap.css"> 
    <link rel="stylesheet" href="https://rawgit.com/g00fy-/angular-datepicker/master/dist/angular-datepicker.css" /> 
    <script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.10.6/moment.min.js"></script> 
    <script src="https://cdnjs.cloudflare.com/ajax/libs/moment-timezone/0.4.1/moment-timezone-with-data.js"></script> 
    <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular.min.js"></script> 
    <script src="https://cdnjs.cloudflare.com/ajax/libs/angular-ui-bootstrap/0.6.0/ui-bootstrap-tpls.min.js"></script> 
    <script src="https://rawgit.com/g00fy-/angular-datepicker/master/app/scripts/datePicker.js"></script> 
    <script src="https://rawgit.com/g00fy-/angular-datepicker/master/app/scripts/datePickerUtils.js"></script> 
    <script src="https://rawgit.com/g00fy-/angular-datepicker/master/app/scripts/dateRange.js"></script> 
    <script src="https://rawgit.com/g00fy-/angular-datepicker/master/app/scripts/input.js"></script> 
    <script src="app.js"></script> 

    </head> 

    <body ng-controller="MainCtrl"> 
    <input class="form-control" date-time ng-model="DateOfbirth" max-date="today" view="date" timezone="UTC" format="yyyy-MM-dd HH:mm"> 
    </body> 

</html> 

ドキュメントの参照を作成しました。 here

答えて

0

私は同じ問題がありました。

最大/最小の日付が必要な機能のいくつか

がない最低の

角度のバージョンに含まれ1.5.xのために角度のバージョンをアップグレードしよう。

0

カスタム$watchを追加して問題を修正しました。

$scope.$watch('addUserProfileData.DateOfbirth', validate_dateOfbirth); 

    function validate_dateOfbirth() { 

     if ($scope.addUserProfileData.DateOfbirth != "") { 

      var selectedDate = moment($scope.addUserProfileData.DateOfbirth.toISOString()).format('DD/MM/YYYY'); 
      var current_date = moment(moment().toISOString()).format('DD/MM/YYYY'); 

      var momentA = moment(selectedDate,"DD/MM/YYYY"); 
      var momentB = moment(current_date,"DD/MM/YYYY"); 

      if (momentA >= momentB) { 

       $scope.addUserProfileForm.DateOfbirth.$setValidity("endBeforeStart", false); 
      } else { 
       $scope.addUserProfileForm.DateOfbirth.$setValidity("endBeforeStart", true); 
      } 
     } 

    } 
関連する問題