简体   繁体   English

单击年份时,月份模式下的角度ui-datepicker不起作用

[英]angular ui-datepicker in month mode not working when year is clicked

in month mode when year is clicked i get 在单击年份的月份模式下,我得到

Expression ''month'' used with directive 'datepicker' is non-assignable! 与指令“ datepicker”一起使用的表达式“ month”是不可分配的!

in my console....I am expecting the calender to go into year mode 在我的控制台中....我希望压延机进入年检模式

this is my plnkr => PLNKR 这是我的plnkr => PLNKR

my html is as follows 我的HTML如下

<div ng-controller="DatepickerDemoCtrl">
      <h4>Month-Year Picker</h4>
      <div class="row">
        <div class="col-md-3">
          <p class="input-group">
            <input type="text" class="form-control col-md-3" 
                datepicker-popup="MMM-yyyy" 
                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>
          </p>
        </div>
      </div>
    </div>

my dateOptions is 我的dateOptions是

 $scope.dateOptions = {
    'year-format': "'yy'",
    'starting-day': 1,
    'datepicker-mode':"'month'",
    'min-mode':"month"
  };

what is going wrong...please help... 出了什么问题...请帮助...

Remove the extra quotes around the month value to be: 删除月份值附近的多余报价为:

'datepicker-mode':"month",

You had: 你有过:

  $scope.dateOptions = {
    'year-format': "'yy'",
    'starting-day': 1,
    'datepicker-mode':"'month'",
    'min-mode':"month"
  };

same issue for: 同样的问题:

'year-format': "'yy'"

Try with 试试看

$scope.dateOptions = {
    'year-format': "'yy'",
    'starting-day': 1,
    'datepickerMode':"'month'",
    'minMode':"month"
  };

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM