javascript - angularjs - ui-bootstrap-tpls-0 datepicker-popup 无法手动输入
问题描述
我正在使用ui-bootstrap-tpls-0.12.0.js
版本。当我通过日历选项(格式 yyyy/MM/dd)选择日期时,它的工作正常。但是,如果我在具有相同格式的输入文本中手动输入日期yyyy/MM/dd
并单击保存按钮。日期值从输入文本框中消失。
请在下面找到我的代码。
<p class="input-group" ng-controller="DatePickerController">
<span class="input-group-btn">
<button type="button" class="btn btn-default" ng-click="open($event)" disabled >
<i class="glyphicon glyphicon-calendar"></i>
</button>
</span>
<input type="text" class="form-control" ng-model="ban.effectiveDate" ng-readonly="true" datepicker-popup="yyyy/MM/dd" is-open="opened" ng-required="true" tabindex = "-1" close-text="Close"/>
</p>
我的控制器:
angular.module('app').controller('DatePickerController', ["$scope",function ($scope) {
$scope.today = function() {
$scope.dt = new Date();
};
$scope.clear = function () {
$scope.dt = null;
};
// Disable weekend selection
$scope.disabled = function(date, mode) {
return ( mode === 'day' && ( date.getDay() === 0 || date.getDay() === 6 ) );
};
$scope.toggleMin = function() {
$scope.minDate = $scope.minDate ? null : new Date();
};
$scope.toggleMin();
$scope.open = function($event) {
$event.preventDefault();
$event.stopPropagation();
$scope.opened = true;
};
$scope.dateOptions = {
formatYear: 'yy',
startingDay: 1
};
$scope.today();
$scope.format = 'yyyy/MM/dd';
}]);
解决方案
推荐阅读
- r - 我正在尝试过滤数据以消除各种变量的异常值(理想情况下为 99% Conf. Interval),但会出现长度错误
- python-3.x - 使用 asyncio 和 matplotlib 同时将蓝牙流式数据传输到出口和计算/绘图
- javascript - 将多个对象数组合并为一个对象数组 JavaScript
- java - 为什么我的 Node 类不能与 java.util.LinkedList 一起使用
- react-native - 如何为反应原生 ios 导入数据文件(json、jsx、js 等)?
- reactjs - 我正在使用 React-Table 及其飞节 useExpanded 创建一个带有详细行的表,但它不起作用
- unity3d - 如何使用 Unity3d 着色器遮盖另一个两遍着色器?
- r - 迭代比例拟合 (IPF) / 使用 R 倾斜
- android - Flutter中这个十六进制代码#6c63ff的颜色名称是什么
- python - 尝试通过循环绘制多个不同的图时,无法在 X 轴上获得正确的“日期”