I have these two functions:
cart() which is an array object (this information is static)
cartItems which is an array object (this information is dynamic)
Inside the cart there can be several cartItems. How do I push different items into this cart so my final result would look like this:
JSON:
"cart": [
{
"id": "1",
"cartItem": [
{
"id": "cart Item 1",
"action": "New",
"quantity": 1,
},
{
"id": "cart Item 2",
"action": "New",
"quantity": 1,
}
}
]
FUNCTIONS:
private cart(): CaCartItemsModel{
return new CaCartItemsModel(
"1",
"Cambio",
"TV"
);
private cartItems(): CaCartItemModel{
return new CaCartItemModel(
"cart Item 1/cart Item 2",
"New",
1
);
}