角UI月份选择器 [英] angular ui month picker

查看:153
本文介绍了角UI月份选择器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将尝试使用角UI的日期选择器在一个月选择器...但不可以配置它,尝试了这一切......这里是 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>

,也可作为的一部分:日期选择器的选项,使用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"   };

但也不能正常工作......请帮助

but that also is not working... please help

推荐答案

有关谁是面临这个问题的人,我已经尝试了很多东西,这里是我发现最简单的方法:

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>

诀窍在于,你必须把日期选择器选项={minMode:'月'}日期选择器模式=月输入标记。这对我来说工作得很好。

The trick is that you must put datepicker-options="{minMode: 'month'}" datepicker-mode="'month'" into the input tag. This worked fine for me.

这篇关于角UI月份选择器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆