0

我在使用 datepicker 时正在使用 Angular 我收到此错误:

HttpErrorResponse {headers: HttpHeaders, status: 500, statusText: "Internal Server Error", url: " http://localhost:53626/api/Customer ", ok: false, ...}error: " ↵http://localhost: 53626/api/Customer:500 内部服务器错误”名称:“HttpErrorResponse”ok:falsestatus:500statusText:“内部服务器错误”url:“ http://localhost:53626/api/Customer原型:HttpResponseBase

<input
      name="dob"
      #dateOfBirth="ngModel"
      [(ngModel)]="service.formData.dateOfBirth"
      class="form-control"
      type="text"
      maxlength="10"
      bsDatepicker
    />

当我删除 bsDatepicker 时,它在简单的 HTML 中运行良好。我也尝试过 Material Datepicker,但服务器错误仍然存​​在。后端模型包含验证,可能从日期选择器发送的数据不匹配:

 public class Customer
    {
        [Key]
        public int id { get; set; }
        [Required]
        [Column(TypeName ="nvarchar(100)")]
        public string name { get; set; }
        [Column(TypeName = "varchar(10)")]
        public string gender { get; set; }
        [Required]
        [Column(TypeName = "varchar(10)")]//10/10/2019
        public string dateOfBirth { get; set; }


        public Boolean isActive { get; set; }

    }
}
4

0 回答 0