Angular UI月份选择器 [英] Angular UI month picker
本文介绍了Angular UI月份选择器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试使用角度-i-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'
进入输入
标签。这对我来说很好。
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屋!
查看全文