AngularUI monthpicker in popup shown as datepicker

隐身守侯 提交于 2019-12-23 05:16:56

问题


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.


回答1:


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




回答2:


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]



来源:https://stackoverflow.com/questions/24180416/angularui-monthpicker-in-popup-shown-as-datepicker

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!