I am using Angular when using datepicker I get this error:
HttpErrorResponse {headers: HttpHeaders, status: 500, statusText: "Internal Server Error", url: "http://localhost:53626/api/Customer", ok: false, …}error: " ↵http://localhost:53626/api/Customer: 500 Internal Server Error"name: "HttpErrorResponse"ok: falsestatus: 500statusText: "Internal Server Error"url: "http://localhost:53626/api/Customer"proto: HttpResponseBase
<input
name="dob"
#dateOfBirth="ngModel"
[(ngModel)]="service.formData.dateOfBirth"
class="form-control"
type="text"
maxlength="10"
bsDatepicker
/>
When I remove bsDatepicker it works fine in simple HTML. I have tried Material Datepicker as well but the server error persists. Back-end model contains validation maybe the data does not match when sent from a date picker:
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; }
}
}