Vladimir Djukic
Vladimir Djukic

Reputation: 965

How to open first years uib-datepicker-popup? [AngularJS]

When I open it calendar show with year and days. Can I make it somehow to first display years?

here is html:

<input style="width: 30%;float: left;" name="date" id="date" type="text" 
                           class="form-control" 
                           uib-datepicker-popup="dd/MM/yyyy"
                           ng-model="ctrl.userProfile.birthDate"
                           is-open="dpOpenStatus.withRequired"
                           ng-required />
                    <span class="input-group-btn">
                        <button type="button" 
                                class="btn btn-default" 
                                ng-click="setDpOpenStatus('withRequired', $event)">
                            <i class="glyphicon glyphicon-calendar"></i>
                        </button>
                    </span> 

Upvotes: 1

Views: 439

Answers (1)

Matt M
Matt M

Reputation: 3779

According to the docs, you can set the datepicker-options object's datepickerMode property to one of the following:

datepickerMode C (Default: day) - Current mode of the datepicker (day|month|year). Can be used to initialize the datepicker in a specific mode.

So, in your view, add this:

datepicker-options="options"

and in your controller, add this:

 $scope.options = {
   datepickerMode: 'year',
   minDate: new Date()
};

Upvotes: 2

Related Questions