Vlado Pandžić
Vlado Pandžić

Reputation: 5058

angular ui boostrap datepicker show years first

I need to show year first at angular ui boostrap datepicker because user needs to select day of birth and it is difficult to figure out there it needs to select on month above to select month, than select on year above to select year. This is what I tried:

$scope.dateOptions = {
    minMode: 'year',
    maxMode:'day'
};

Upvotes: 0

Views: 73

Answers (2)

Saad
Saad

Reputation: 952

As you are using ui.bootstrap 0.13.4, you need to set it as attribute in the datepicker element or you need configure datepickerConfig to apply globally. While defining as an attribute write like this:

datepicker-mode="'year'"

Don't forget to use single quote inside the double quotes(or vice versa).

See the updated plunk after defining the attribute http://plnkr.co/edit/xNg244qbfgTnAcginH43?p=preview

Upvotes: 1

Kyle
Kyle

Reputation: 5557

Working Plunk: http://plnkr.co/edit/KAVPzZOOJPpKbEyio1Yg?p=preview

This is what you want: datepickerMode: 'year'.

$scope.options = {
  datepickerMode: 'year'
};

Upvotes: 2

Related Questions