jeudi 12 mars 2015

How to push object inside the object angularjs/javascript


Vote count:

0




How to push objects inside the object? I have the following data:



$scope.data = [{
"top": "2",
"status": "1",
"name": "Anna",
"address": "Califirnia"
}, {
"top": "2",
"status": "1",
"name": "Jodie",
"address": "Califirnia"
}, {
"top": "2",
"status": "1",
"name": "susan",
"address": "Califirnia"
}];


And I have the following output:



{
1:{
2:3
}
}


The 1 in output means status object. 2 means top object and 3 means the number of students who's top is in 2.


Now I want to push the address inside the object. So the output would be:



{
1:{
2:3,
"address":"califirnia"
}
}


How will I do that. Thanks. My fiddle is http://ift.tt/1BzoEey



asked 18 secs ago







How to push object inside the object angularjs/javascript

Aucun commentaire:

Enregistrer un commentaire