中的minDate我有這兩個datepickers:第一次約會的第二
<div class="form-group" ng-controller="datepickerpopupCtrl">
<label>Start date:</label>
<p class="input-group">
<input ng-model="task.startdate" name="startdate" type="text" class="form-control"
uib-datepicker-popup="{{format}}"
datepicker-options="options"
is-open="opened"
ng-required="true"
close-text="Close"
alt-input-formats="altInputFormats"
show-button-bar="false"
placeholder="startdate" />
<span class="input-group-btn">
<button type="button" class="btn btn-default" ng-click="open()"><i
class="glyphicon glyphicon-calendar"></i></button>
</span>
</p>
</div>
<div class="form-group" ng-controller="datepickerpopupCtrl">
<label>End date:</label>
<p class="input-group">
<input ng-model="task.enddate" name="enddate" type="text" class="form-control"
uib-datepicker-popup="{{format}}"
datepicker-options="optionsEndDate"
is-open="opened"
ng-required="true"
close-text="Close"
alt-input-formats="altInputFormats"
show-button-bar="false"
placeholder="Date de fin"
/>
<span class="input-group-btn">
<button type="button" class="btn btn-default" ng-click="open()"><i
class="glyphicon glyphicon-calendar"></i></button>
</span>
</p>
</div>
我想enddate
(第二日期選擇器)由第一日起startdate
限制。
現在我已經試過這樣:
function datepickerpopupCtrl($scope) {
$scope.dt = new Date();
$scope.open = open;
$scope.opened = false;
$scope.formats = ['dd-MMMM-yyyy', 'yyyy/MM/dd', 'dd.MM.yyyy', 'shortDate'];
$scope.format = $scope.formats[0];
$scope.options = {
showWeeks: false,
minDate : new Date(),
startDate : new Date()
};
$scope.optionsEndDate = {
showWeeks: false,
minDate : ($scope.task.startdate == undefined) ? new Date() : $scope.task.dateDebut,
startDate : new Date()
};
function open() {
$scope.opened = true;
}
}
})
,但它不工作。
任何建議將appreciated.thanks
plunkr/fiddle or codepen pls – Pavan