Update: I'm trying to construct a table out of my data structure(ie section1) and then allow users to add rows to the table to insert more rows and save them to my datastructure.
I have an array newArr in the form of key value pairs. When somebody clicks a button, I want to be able to push the newArray into the Groups.I dont seem to be able to push into the Groups array. Chrome dev tools shows Groups as Objects and i'm not certain how to loop through and append to each item of the Groups Object. Feel free to modify the $scope.section1 to a different datastructure that could make it easier to push new items to it.
$scope.section1 = [{
"id":1, "Name": "Section 1: Inventory",
"Groups":[
{"cell" : "Number", "cellValue" : "value1"},
{"cell" : "Location", "cellValue" : "value2"},
{"cell" : "Severity", "cellValue" : "value3"}
],
"FootNotes":[
{"templateurl" : "components/section/templates/notes/section1.notes.html"}
]
}]
var newArr = {"cellValue" : "value4","cellValue" : "value5","cellValue" : "value6"}
So the output should look like
$scope.section1 = [{
"id":1, "Name": "Section 1: Inventory",
"Groups":[
{"cell" : "Number", "cellValue" : "value1", "cellValue" : "value4"},
{"cell" : "Location", "cellValue" : "value2", "cellValue" : "value5"},
{"cell" : "Severity", "cellValue" : "value3", "cellValue" : "value6"}
],
"FootNotes":[
{"templateurl" : "components/section/templates/notes/section1.notes.html"}
]
}]