1

In this plunk I have an Angular UI datepicker that shows up below the input field. I want the calendar to be displayed on top of the field, so I tried with popup-placement="top-left" but it doesn't work. Any ideas?

HTML

<p class="input-group">
      <input type="text" class="form-control"  ng-model="dt" is-open="opened"
           datepicker-popup="dd-MMM-yyyy" popup-placement="top-left" 
           datepicker-options="dateOptions" ng-required="true" close-text="Close" />
      <span class="input-group-btn">
        <button type="button" class="btn btn-default" ng-click="open1($event)">
           <i class="glyphicon glyphicon-calendar"></i>
        </button>
      </span>
  </p>

Javascript

var app = angular.module('app', ['ui.bootstrap']);
app.controller('ctl', function ($scope) {


    $scope.opened = false;

    $scope.dateOptions = {
       showWeeks: false
    };


    $scope.open1 = function(event){
        event.preventDefault();
        event.stopPropagation();
        $scope.opened = true;
      };


});

2 Answers 2

6

popup-placement directive does not exist on ui-bootstrap version 0.13. it seems like it's only been added since version 1.2.0.

Best thing would be to update your version, previous versions don't seem to support that option (you can always manipulate the css but that's quite dangerous).

Working plunker with updated ui-bootstrap and angular versions.

Sign up to request clarification or add additional context in comments.

Comments

0

i have solved your problem and created a plunker: http://plnkr.co/edit/PsCjLBzWk5QRHO2EIPIe?p=preview.

your ui-bootstrap version should be updated.

you need to updated your angularjs version 1.5.0, ui-bootstrap version 1.2.4, bootstrap 3.3.6, and then add uib-datepicker-popup="{{format}}" to your datepicker input element.

2 Comments

Yes, you can try it!
i don't think my answer is the same to your one. I posted this answer which only marks my try to solve this problem!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.