I am attempting to populate my form with the corresponding values from 'myproduct' where the id_product matches the input. However, when I run the code, the value is not returned. Can anyone spot what's wrong with my code?
this.products.forEach(i => {
if(this.products[i].id == item.id_product)
{
this.form.product_name = this.products[i].product_name;
this.form.id_category = this.products[i].id_category;
this.form.description = this.products[i].description;
this.form.price = this.products[i].price;
this.form.color = this.products[i].color;
this.form.size = this.products[i].size;
this.form.stock = this.products[i].stock;
this.form.weight = this.products[i].weight;
}
});