【发布时间】:2016-02-06 00:27:13
【问题描述】:
我正在使用角度日期选择器。但它给出了以下错误。你能告诉我如何解决它。提前致谢。
HTML
<input type="date" uib-datepicker-popup ng-model="vm.property.deedDate"
is-open="status.opened" datepicker-options="vm.dateOptions"
date-disabled="disabled(date, mode)" ng-required="true" close-text="Close" />
JS
vm.property = {};
vm.init = function () {
propertyService.getPropertyForEdit({
id: propertyId
}).success(function (result) {
vm.property = result.property;
vm.property.deedDate = moment(vm.property.deedDate);
});
};
vm.init();
从 Web Api 返回:
Web Api Dto 对象:
public class PropertyEditDto : IOutputDto
{
public int Id { get; set; }
public DateTime DeedDate { get; set; }
}
它给出了下面提到的控制台错误:
【问题讨论】:
-
请检查answer
-
@macrog 我已经这样设置了
vm.property.deedDate = moment();。但它仍然给出同样的错误。为什么? -
我不知道,创建一个 plunker 以便我可以帮助你
-
@macrog 当我像这样使用
vm.property.deedDate = new Date(vm.property.deedDate);时它正在工作。你能告诉我为什么它不能与moment()一起工作吗? -
moment()在没有任何 .format 的情况下创建了什么?我不确定我从来没有像这样使用它 我通常会为这样的时刻提供一些格式moment().toISOString();不太确定你的问题可能是什么。
标签: c# angularjs datepicker asp.net-web-api2