【发布时间】:2015-09-04 14:01:55
【问题描述】:
我想要做的是当用户选择特定日期时,能够将该日期用作字符串,将其作为数据放入 JSON 对象并从数据库中检索数据作为响应。
选择我想要在控制台日志中获取的日期:
Fri Sep 04 2015 16:15:24 GMT+0300 (GTB Daylight Time)
为了使用它,我想把它转换成这个:
20150904
我什至使用了一个指令,但我想这只是为了预览。
.directive('datepickerPopup', function (){
return {
restrict: 'EAC',
require: 'ngModel',
link: function(scope, element, attr, controller) {
//remove the default formatter from the input directive to prevent conflict
controller.$formatters.shift();
}
}
});
有人知道这将如何完成吗? 提前谢谢!
【问题讨论】:
标签: angularjs angular-ui-bootstrap bootstrap-datepicker