Angular UI 月份选择器 [英] Angular UI month picker
本文介绍了Angular UI 月份选择器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试使用 angular-ui-datepicker 作为月份选择器.但无法配置它,尝试了所有.这是PLUNKER.
I am trying to use angular-ui-datepicker as a month picker. But not able to configure it, tried it all. Here is the PLUNKER.
我尝试将模式设置为
<input type="text" class="form-control col-md-3"
datepicker-popup="MMM-yyyy" min-mode="'month'" datepicker-mode="'month'"
ng-model="dt" is-open="opened" close-on-date-selection="true"
datepicker-options="dateOptions" date-disabled="disabled(date, mode)"
show-button-bar="false" show-weeks="false"/>
<span class="input-group-btn">
<button class="btn btn-default" ng-click="open($event)">
<i class="glyphicon glyphicon-calendar"></i>
</button>
</span>
也作为一部分:datepicker-options,使用JS作为
And also as part of: datepicker-options, using JS as
$scope.dateOptions = {
'year-format': "'yy'",
'starting-day': 1,
'datepicker-mode':"'month'",
'min-mode':"month" };
但这也行不通.请帮忙
推荐答案
对于那些面临这个问题的人,我尝试了很多方法,这里是我找到的最简单的方法:
For those people who are facing this issue, I have tried a lot of things and here is the simplest method that I found:
<input type="text" class="form-control" datepicker-popup="MM/yyyy" ng-model="dt" is-open="opened" datepicker-options="{minMode: 'month'}" datepicker-mode="'month'"/>
<span class="input-group-btn">
<button type="button" class="btn btn-default" ng-click="open($event)"><i class="glyphicon glyphicon-calendar"></i></button>
</span>
诀窍是您必须将 datepicker-options="{minMode: 'month'}" datepicker-mode="'month'"
放入 input
标签.这对我来说很好.
The trick is that you must put datepicker-options="{minMode: 'month'}" datepicker-mode="'month'"
into the input
tag. This worked fine for me.
这篇关于Angular UI 月份选择器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文