I'm currently working on an Angular app that utilizes UI Bootstrap. Within my app, I have a modal containing a Datepicker at the bottom. However, I've encountered an issue where the Datepicker remains confined within the modal when expanded. I attempted to adjust the z-index
, but it didn't resolve the problem. Below is the snippet of my HTML for the Datepicker:
<div class="control-group">
<label class="control-label">Birth Date:</label>
<div class="controls">
<div class="form-horizontal" ng-controller="DatepickerCtrl">
<input name="birthdate" class="input-thick" type="text" datepicker-popup="MM/dd/yyyy" ng-model="model.dateOfBirth" is-open="opened" min="minDate" max="'2013-11-11'" datepicker-options="dateOptions" date-disabled="disabled(date, mode)" ng-required="true" required />
<button class="btn" ng-click="open()"><i class="icon-calendar"></i></button>
<p ng-show="!addPatientForm.birthdate.$valid && formSubmitted" class="form-error"><i class="fa fa-exclamation-circle "></i> <b>Date of Birth: </b>Enter a date in the format MM/DD/YYYY. It cannot be a future date.</p>
</div>
</div>
</div>
Additionally, here is the relevant JavaScript code (js
):
App.controller('DatepickerCtrl', function ($scope, $routeParams, $modal, $timeout) {
$scope.today = function() {
$scope.dt = new Date();
};
$scope.today();
$scope.showWeeks = true;
$scope.toggleWeeks = function () {
$scope.showWeeks = ! $scope.showWeeks;
};
$scope.clear = function () {
$scope.dt = null;
};
$scope.toggleMin = function() {
$scope.minDate = ( $scope.minDate ) ? null : new Date();
};
$scope.open = function() {
$timeout(function() {
$scope.opened = true;
});
};
$scope.dateOptions = {
'year-format': 'yy',
'starting-day': 1
};
});
If you'd like to see the issue first-hand, feel free to check out this Plunker. Any insights or suggestions on how to fix the Datepicker display problem would be greatly appreciated.