2

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...

2 Answers2

0

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'"
Arthur Frankel
  • 4,695
  • 6
  • 35
  • 56
  • tried that.. not working... can you please try it on plunker... [LINK HERE](http://plnkr.co/edit/ukkLalXDqvMhFalRdZ0r?p=preview) – harishr Jul 15 '14 at 08:22
  • don't have any other suggestions besides what others have suggested here: http://stackoverflow.com/questions/23737270/angular-ui-month-picker – Arthur Frankel Jul 15 '14 at 20:39
  • 1
    The real issue is that modes specified as literal strings are not supported by now. You have to use a binding. The same applies to other options ['minDate', 'maxDate', 'datepickerMode', 'initDate', 'shortcutPropagation'] as well. Track this [issue](https://github.com/angular-ui/bootstrap/issues/3155) – klaus triendl Apr 15 '15 at 12:30
-1

Try with

$scope.dateOptions = {
    'year-format': "'yy'",
    'starting-day': 1,
    'datepickerMode':"'month'",
    'minMode':"month"
  };
tjati
  • 5,761
  • 4
  • 41
  • 56