。
我一直在使用 Ui 角度引导日期选择器,它一直工作正常......在铬中。
事实证明,Firefox和safari不会显示日期选择器。以前有人遇到过这种情况。
我的 HTML 看起来像这样
<p class="input-group">
<input type="date" class="form-control" datepicker-popup ng-model="startDate" is-open="status.opened" min-date="minDate" max-date="maxDate" datepicker-options="dateOptions" date-disabled="disabled(date, mode)" close-text="Close" />
</p>
我的JS/控制器看起来像这样
$scope.today = function () {
$scope.startDate = new Date();
$scope.startDate.setMonth($scope.startDate.getMonth() - 1);
$scope.endDate = new Date();
$scope.endDate.setMonth($scope.endDate.getMonth() + 1);
};
$scope.today();
$scope.clear = function () {
$scope.dt = null;
};
// Disable weekend selection
$scope.disabled = function (date, mode) {
return (mode === 'day' && (date.getDay() === 0 || date.getDay() === 6));
};
$scope.open = function ($event) {
$scope.status.opened = true;
};
$scope.setDate = function (year, month, day) {
$scope.startDate = new Date(year, month, day);
$scope.endDate = new Date(year, month, day);
};
$scope.dateOptions = {
formatYear: 'yy',
};
$scope.formats = ['dd-MMMM-yyyy', 'yyyy/MM/dd', 'dd.MM.yyyy', 'shortDate'];
$scope.format = $scope.formats[0];
$scope.status = {
opened: false
};
如前所述 这有效。但是在Firefox和safari中,它不显示日期选择器,但它在chrome中显示
不确定您使用的是哪个版本的UI Bootstrap
,但在 1.2.4 中,日期选择器标记如下所示:
<input type="text" class="form-control" uib-datepicker-popup ng-model="startDate" is-open="opened" ... />
在 FF 44 和 IE 11 中尝试了您的代码 - 对我来说似乎很好:http://plnkr.co/edit/deE1lR?p=preview