user1563700
user1563700

Reputation:

AngularUI monthpicker in popup shown as datepicker

I'm trying to use the angular ui datepicker in monthpicker-mode as a popup, but it is shown as a datepicker.

I've found a working example of the monthpicker as inline-picker here, but I need it as a popup.

Here is a plunker of what I've tried, based on the official example.

Upvotes: 0

Views: 3653

Answers (2)

Md Ashaduzzaman
Md Ashaduzzaman

Reputation: 4038

There are some syntax problems in your code.

the directives max-mode and min-mode will take parameters covered with a single quote. So the proper way should be,

<input type="text" show-weeks="false" show-button-bar="false" class="form-control" datepicker-popup="{{format}}" ng-model="dt" is-open="status.opened" min-date="minDate" max-date="maxDate" datepicker-options="dateOptions" date-disabled="disabled(date, mode)" ng-required="true" min-mode="'month'" max-mode="'month'" />

You can checkout the docs of Angular Bootstrap from here and search for DatePicker where the functionalities of min-mode and max-mode directives are explained.

For example check this demo

[Note : Though it's too late to answer this question, but you may find it helpful]

Upvotes: 2

jfornoff
jfornoff

Reputation: 1378

i managed to fix it.

http://plnkr.co/edit/tvte8r1EbjbeDZLn2ivq

The most important thing was that there was an issue with the datepickerMode not being parsed correctly thus the datepicker starting in day-mode instead of month. I just imported the latest version out of the angular-ui bootstrap repository.

The rest was basically just modifying the dateOptions and setting the datepicker-mode to popupMode.

Hope you're good now ;-) Cheers, Jan

Upvotes: 2

Related Questions