ui-bootstrap Datepicker not working

42,698

Solution 1

I'm not sure this will get you all the way to your objective, but I think the hurdle you are facing is that you forgot to import ui.bootstrap when creating your 'foo' app.

http://plnkr.co/edit/ZGl0VuJjVF1nliMidaL6

Solution 2

Ensure you have the is-open attribute defined in the markup.

<input type="text" class="form-control" datepicker-popup="date.format" ng-model="date.selectedDate" max-date="date.maxDate" datepicker-options="date.dateOptions" date-disabled="date.disabled(date, mode)" ng-required="true" close-text="Close" show-weeks="false" is-open="date.opened" ng-focus="date.opened=true" />
Share:
42,698
agusluc
Author by

agusluc

Full-stack Web Developer from Argentina

Updated on October 08, 2020

Comments

  • agusluc
    agusluc over 3 years

    I'm trying to create a directive for the datepicker, but the popup is not working (neither clicking in the textfield or the button)

    Plunker: http://plnkr.co/edit/hUxQASblscbhFZFvWDyN

    p.d: the idea is remove all datepicker code from the controller (cause the datepicker will be used in many controllers), so please don't suggest move the open and close function to the page controller.

  • agusluc
    agusluc about 10 years
    i updated my plunker with the import, but is not working. Yours is working, did u change something else?
  • pherris
    pherris about 10 years
    the only other thing that I can see missing in yours is the datepicker-popup from the input tag. "datepicker-popup (Default: 'yyyy-MM-dd') : The format for displayed dates."
  • agusluc
    agusluc about 10 years
    yes, it was the datepicker-popup (strange, is not needed if u use the datepicker in the "standar" way). Also found another problem, my controler was including a config module that is not defined (its a leftover of the original code in my project). Thx!
  • pherris
    pherris about 10 years
    Sure! This issue may be related to the issue discussed here: github.com/angular-ui/bootstrap/pull/1809