AngularJS的5周日期选择器
AngularJS中的datepicker(AngularJS的5周日期选择器,angularjs,datepicker,angular-ui-bootstrap,Angularjs,Datepicker,Angular Ui Bootstrap,AngularJS中的datepicker(ui.bootstrap.datepicker)显示了指定月份的6周日历 默认情况下,我们如何将其更改为每月5weeks日期选择器,并且仅在必要时使用6周行 <input type="text" class="form-control datedesktop" uib-datepicker-popup="{{format}}" ng-model="dt" is-op
ui.bootstrap.datepicker
)显示了指定月份的6周日历
默认情况下,我们如何将其更改为每月5
weeks日期选择器,并且仅在必要时使用6周行
<input type="text" class="form-control datedesktop"
uib-datepicker-popup="{{format}}"
ng-model="dt"
is-open="popup1.opened"
datepicker-options="dateOptions"
ng-required="true"
show-button-bar="true"
show-weeks="false"
alt-input-formats="altInputFormats"
on-open-focus="false"
close-text="X"
clear-text=""
ng-click="open()" />
<span class="input-group-btn">
<button type="button" class="btn btn-default btn-calendar" ng-click="open()">
<i class="glyphicon glyphicon-calendar"></i>
</button>
</span>
正如@svarog提到的,覆盖模板是最好的方法 没有选择改为5周 如果您看到(第399行)
第42周(6周*7天)的编号为硬编码。如果您将42替换为35,(5周*7行),这将为您提供5周的日历 当不得不隐藏不属于当前月份的行时,会遇到类似的问题。也许我的解决方案对某些人有用。UI引导版本2.5.0 覆盖了uib/template/datepicker/day.html模板
"<tr class=\"uib-weeks\" ng-repeat=\"row in rows track by $index\" role=\"row\">\n"
“\n”
改为
"<tr class=\"uib-weeks\" ng-repeat=\"row in rows track by $index\" role=\"row\" ng-hide=\"row[0].secondary && row[6].secondary\">\n"
“\n”
第[0]行。第二行和第[6]行。第二行
条件检查一周中的第一天和最后一天是否不属于当前月份 请分享一些您尝试过的代码示例。如果使用datepicker月模板,您可以在github源repo中找到它
"<tr class=\"uib-weeks\" ng-repeat=\"row in rows track by $index\" role=\"row\" ng-hide=\"row[0].secondary && row[6].secondary\">\n"