I'mbuildingashoppingcartwithdynamicoptionswithAngularjs.
Theproblemishere:
{
"14": [
{
"id": 3,
"forma": "Alface",
"preco": 1
},
{
"3": 1
}
],
"15": [
{
"id": 3,
"forma": "Alface",
"preco": 1
},
{
"3": 1
}
]
}
I need when I add the optional array, that quantity joins it, thus:
{
"14": [
{
"3": 1,
"id": 3,
"forma": "Alface",
"preco": 1
}
],
"15": [
{
"3": 1,
"id": 3,
"forma": "Alface",
"preco": 1
}
]
}
This is the option code:
$scope.ck = function(id) {
var oidsa = {"3": 1};
$scope.user.roles[id].push(oidsa);
alert($scope.user.roles[id]);
};