更新时间:2022-12-05 09:46:38
是.有一个名为md-date-filter
的属性,您可以使用该属性指定用户要选择的日期.在下面的示例中,当您重试return day === 1;
时,它将仅选择星期一.您可以根据需要将其从o更改为7.
Yes. There is an attribut called md-date-filter
which you can use to specify the day you want to be selected by user. In the below example as you are returing return day === 1;
It will allow to select mondays only. you can change it from o to 7 as required.
html查看文件
<md-datepicker ng-model="myDate" md-placeholder="Enter date" md-date-filter="onlyMonday">
</md-datepicker>
在控制器文件中
$scope.onlyMonday = function(date) {
var day = date.getDay();
return day === 1;
}