Hi,
In my angular project I would like to push a number to an array within an array
I am not sure this is the correct way as it doesn’t seem to be working
addNewOrder(order_id) {
console.log('ORDER_ID: ', order_id);
this.Ordersummary.subscribe(
os => {
os.push(this.Orderlist = order_id);
order_id.next(os);
});
}
I would like to have something like the following:
Orderlist [{
order_id: 1,
order_summary: [
{
this: 'that',
here: 'now'
},
{
this: 'that again',
here: 'now then'
}]
}]
when you click add new order to get the following:
Orderlist [{
order_id: 1,
order_summary: [
{
this: 'that',
here: 'now'
},
{
this: 'that again',
here: 'now then'
}]
},
{
order_id: 2,
order_summary: [
{
this: 'that2',
here: 'now2'
},
{
this: 'that again2',
here: 'now then2'
}]
}]