I am attempting to transfer these item details to a form, but I keep encountering undefined values for this.itemDetails.item1Qty, etc. My goal is to display them in the Form UI.
this.wareHouseGroup = this.formBuilder.group({
id: this.formBuilder.control(this.warehouse.id),
sideId: this.formBuilder.control(this.warehouse.sideId.toString(), [
Validators.required,
Validators.min(1)
]),
itemDetail: this.formBuilder.group({
Item1Qty: this.formBuilder.control(this.itemDetails.item1Qty),
item2Qty: this.formBuilder.control(this.itemDetails.item2Qty),
item3Qty: this.formBuilder.control(this.itemDetails.item3Qty)
})
});
this.itemService.getItemDetails(this.item.uid).subscribe((result) => {
this.itemDetails = result != null ? result : null;
console.log(this.itemDetails);
});
here is the console log
{"id":117,"TypeId":1,"item1Qty":563,"item2Qty":3.00,"item3Qty":0,"itemType":"Discount"}