Wednesday, 7 August 2013

Ember - how to use pushObject on nested data object?

Ember - how to use pushObject on nested data object?

I can already push a new object into the jobs and jobProducts array thanks
to this post How to create nested models in Ember.js?
but I cannot seem to push new allocations or deliverys. I have included
the JSON object below.
Any advice is appreciated, I will put together a fiddle of where I
currently am when I get a moment.
Cheers
App.jobs = [{
id: 0,
jobTitle: "This is the only job",
jobProducts: [{
id: 0,
productTitle: "Product 1",
allocations:[{
id: 0,
allocationTitle: "Allocation 1",
deliverys:[{
id: 0,
deliveryTitle: "Delivery 1"
},
{
id: 1,
deliveryTitle: "Delivery 2"
}]
},{
id: 1,
allocationTitle: "Allocation 2",
deliverys:[{
id: 0,
deliveryTitle: "Delivery 3"
},
{
id: 1,
deliveryTitle: "Delivery 4"
}]
}]
},{
id: 1,
productTitle: "Product 2",
allocations:[{
id: 0,
allocationTitle: "Allocation 3",
deliverys:[{
id: 0,
deliveryTitle: "Delivery 5"
},
{
id: 1,
deliveryTitle: "Delivery 6"
}]
},{
id: 1,
allocationTitle: "Allocation 4",
deliverys:[{
id: 0,
deliveryTitle: "Delivery 7"
},
{
id: 1,
deliveryTitle: "Delivery 8"
}]
}]
}]
};

No comments:

Post a Comment