Angular UI Datepicker 将天数限制为一个月 [英] Angular UI Datepicker Limiting Days to One Month
问题描述
我正在使用 用于 AngularUI 的日期选择器.
默认情况下,它会列出上个月和下个月的天数.这是一张图片.
By default it lists the days from the previous month and the next month. Here's a picture.
我如何让这些日子不可见.我希望第一天永远是星期天.所以应该在列的顶部列出星期日、星期一、星期二等日期.
How do I make these days invisible. I'd like the first day to always be Sunday. So the days should be listed Sunday, Monday, Tuesday, etc on top of the columns.
推荐答案
你可以用 css 做到这一点:
You could do this with css:
.text-muted {
color: transparent;
}
http://plnkr.co/EOS6geIcM5KO6tBwlxZF
但是,您可能需要使其更具体,以避免干扰可能使用 text-muted
的其他引导元素.
But, you probably need to make it more specific to avoid interfering with other bootstrap elements that may use text-muted
.
更新要进一步禁用现在不可见的日子,您可以自定义 ng-disable
在每一天引用的 disable
函数.例如:
Update
To go further and disable the now invisible days, you can customize the disable
function that is referenced by ng-disable
on each day. For example:
$scope.disabled = function(date, mode) {
return date.getMonth() !== $scope.dt.getMonth();
};
这过于简单,但适用于初始日期,应该可以帮助您入门.
This is overly simplistic, but works for the initial date and should get you started.
这篇关于Angular UI Datepicker 将天数限制为一个月的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!