I want to send a POST like this;
{
"title": "sample string 2",
"comment": "sample string 5",
"child": {
"name": "sample string 2"
},
"children": [
{
"name": "sample string"
},
{
"name": "sample string"
}
]
}
I am currently sending this
{
"title": "sample string 2",
"comment": "sample string 5"
}
using this (in the controller)
vm.product = new Product();
vm.product.title = "My title";
vm.product.comment = "my comment";
with this resource factory
myApp.factory('Product', function ($resource) {
return $resource('http://api.com/api/product/:id', { id: '@id' }, {
update: {
method: 'PUT'
}
});
});
The above works. My questions is, how would i change the above code, so i can send child objects, as seen in the top?
I tried with
vm.product.child.name = "my new child"
But with no luck.