我一直在使用Ui角度自举式日期选择器,它在Chrome中工作得很好....
事实证明,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 / Controller看起来像这样
$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中也是如此。
答案 0 :(得分:0)
不确定您使用的UI Bootstrap
版本,但在1.2.4中,datepicker标记如下所示:
<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