在 Angular 13 應用程式中,使用
編輯代碼
loadEventToEdit() {
this.eventService.getEventByCode(this.eventCode).subscribe((res) => {
this.event = res;
console.log('the event to update', this.event);
this.theForm.patchValue(res);
其余的檔案路徑值作業正常。
uj5u.com熱心網友回復:
在patchValue將日期設定為新日期之前。
loadEventToEdit() {
this.eventService.getEventByCode(this.eventCode).subscribe((res) => {
this.event = res;
console.log('the event to update', this.event);
this.event.timing.eventStartDate = new Date(
this.event.timing.eventStartDate
);
this.theForm.patchValue(this.event);
uj5u.com熱心網友回復:
為您的 res 提供完整的方式,其中 res 必須修補。對于 FormArray,您必須先制作 getter,然后您可以使用Push 或 insert方法來修補表單陣列
loadEventToEdit() {
this.eventService.getEventByCode(this.eventCode).subscribe((res) => {
this.event = res;
this.theForm.controls['eventStartDate'].patchValue(this.event.timing.eventStartDate);
})
}
轉載請註明出處,本文鏈接:https://www.uj5u.com/caozuo/387504.html
標籤:有角的 角反应形式 编辑 Primeng-日历
