简体   繁体   中英

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!

in my console....I am expecting the calender to go into year mode

this is my plnkr => PLNKR

my html is as follows

<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

 $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"
  };

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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