Here's the data I received:
{
0:{modifierId: 4, modifierName: 'Garlic', modifierPrice: 60 }
1:{modifierId: 1, modifierName: 'Tartar ', modifierPrice: 60}
2:{modifierId: 3, modifierName: 'Herb ', modifierPrice: 60}
itemId:387
itemName:"BUFFALO WINGS"
itemPrice:500
itemQuantity:0
}
I have a project in angular focused on point of sale. The idea is that when a user clicks on an itemName button, it should show its modifiers in a dialog box. All this information is fetched from a restful API. When a modifier is clicked, its object is passed into the item's object. However, when trying to display the items in the cart using ngFor*, an error occurs. Angular does not support passing objects in ngFor*, as it only works with arrays.
The desired output is:
[
0:{modifierId: 4, modifierName: 'Garlic', modifierPrice: 60}
1:{modifierId: 1, modifierName: 'Tartar ', modifierPrice: 60}
2:{modifierId: 3, modifierName: 'Herb ', modifierPrice: 60}
itemId:387
itemName:"BUFFALO WINGS"
itemPrice:500
itemQuantity:0
*length:3*
]
Now, the goal is to pass the modifier's object into an array. How can I achieve this?