【发布时间】:2017-10-11 20:54:00
【问题描述】:
我在编码方面很新,我有 2 个日期选择器想要设置第二个的最小日期与第一个相同,如果第二个选择成为角度材料中第一个的最大日期 任何人都可以有一些想法
JS:
angular.module('clientApp')
.controller('dateController', function dateController($scope) {
$scope.myDate = new Date();
$scope.minDate = new Date(
$scope.myDate.getFullYear(),
$scope.myDate.getMonth(),
$scope.myDate.getDate()
);
$scope.myDate = null;
});
HTML:
<md-input-container class="col-md-12" flex>
<label>Check in</label>
<md-datepicker
name="dateField"
ng-model="ctrl.myDate"
md-min-date="minDate"
md-hide-icons="all"
ng-required="true"
md-current-view="month"
md-open-on-focus
ng-messages>
</md-datepicker>
<div ng-messages="myForm.dateField.$error">
<div ng-message="required">This date is required!</div>
</div>
</md-input-container>
感谢任何想法和帮助
【问题讨论】:
-
能否详细解释一下
标签: angularjs angular-material