看看這可以幫助你
<!DOCTYPE html>
<html ng-app="plunker">
<head>
<meta charset="utf-8" />
<title>AngularJS Plunker</title>
<link data-require="[email protected]" data-semver="3.1.1" rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" />
<script>document.write('<base href="' + document.location + '" />');</script>
<link rel="stylesheet" href="style.css" />
<script data-require="[email protected]" src="https://code.angularjs.org/1.2.16/angular.js" data-semver="1.2.16"></script>
<script data-require="[email protected]" data-semver="0.10.0" src="http://angular-ui.github.io/bootstrap/ui-bootstrap-tpls-0.10.0.js"></script>
<script src="app.js"></script>
</head>
<body ng-controller="MainCtrl">
Min Date {{minDate}}
<input type="text" class="form-control" datepicker-popup="yyyy-MM-dd" ng-
model="dt" min="minDate" />
</body>
</html>
//JS
var app = angular.module('plunker', ['ui.bootstrap']);
app.controller('MainCtrl', function($scope) {
$scope.minDate = new Date();
$scope.test = function() {
$scope.minDate = new Date();
}
});
這個新的日期將會把yourDate以正確的格式,所以我會把這個代碼在這裏Plunker,和一個suggetion的例子,
var mydate = new Date('2014-04-03');
<input id="StartDate" type="text" class="form-control" name="StartDate"
datetime-picker="{{'yyyy-MM-dd HH:mm'}}" ng-model="vm.StartDate" is-
open="vm.datePickerOpenStatus.StartDate" datepicker-options="dateOptions"
min-date="mydate"/> //Example
這將您的日期轉換爲正確的格式:)
的可能的複製[角UI日期選擇分鐘日期不工作(https://stackoverflow.com/questions/25445786/angular-ui-date-picker-min-date -is-not-working) –
我以前嘗試過,但沒有奏效。感謝您的關注。 –