gpt4 book ai didi

javascript - Angular - UI Bootstrap Datepicker 不显示在 Bootstrap Modal 上

转载 作者:行者123 更新时间:2023-11-28 00:03:09 26 4
gpt4 key购买 nike

我有一个使用 UI Bootstrap 的 Angular 应用程序。我在模态底部有一个带有日期选择器的模态。展开 Datepicker 时,它停留在模式内。我试过更改 z-index,但这并没有改变任何东西。这是我的日期选择器的 html:

<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>

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
};
});

Here是一个 plunker 来展示我的问题。我需要做什么才能使我的 Datepicker 正确显示?

最佳答案

.modal-body 中删除样式 overflow-y: auto 解决了这个问题。现在,overflow-y 属性会在内容溢出(在本例中为日期选择器)时自动添加滚动条,而不是让它溢出模态主体之外。

关于javascript - Angular - UI Bootstrap Datepicker 不显示在 Bootstrap Modal 上,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20217962/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com