Hello Team at Stack Overflow, When I click the edit link to modify customer details, the edit form is displayed. The form shows all existing data except for the datepicker data which is not being displayed. All the data is coming from the Web API.
EditUserComponent.html
<mat-form-field class="demo-full-width">
<input matInput [matDatepicker]="picker" matTooltip="Enter Date Of Birth"
placeholder="Choose Date Of Birth" formControlName="DateOfBirth">
<mat-datepicker-toggle matSuffix [for]="picker"></mat-datepicker-toggle>
<mat-datepicker #picker></mat-datepicker>
</mat-form-field>
EditUserComponent.ts
this.service.getRegistrationDetails(this.registrationId).subscribe(data => {
this.updateUserForm.controls['First_Name'].setValue(data.FirstName);
const dateOfBirth = this.datePipe.transform(data.DateOfBirth.toString(), 'MM/dd/yyyy');});
Service.ts
getRegistrationDetails(registrationId: string): Observable<Register> {
// debugger;
return this.http.get<Register>(this.url + '/GetRegistration/' + registrationId);
}