I am usingng-repeat
to display a number of exercises in the view. Each exercise has a number of parameters bound to checkboxes. The aim is to select the checkboxes and click save and this will create an array in the following structure as a child of the parent object - exercise
:
[{
"name": "Sets",
"checked": true
}, {
"name": "Reps",
"checked": true
}, {
"name": "Weight",
"checked": false
}]
My current structure gives me the following which is difficult for me to use in my app:
{"Sets":true,"Weight":true}
These results are going to be saved to Parse.com so when they are retrieved the checkboxes should be bound and be automatically checked if the value is true
.
I have created a plunker to try and illustrate my issue.
The desired object to be saved to Parse.com is like this:
{
"exerciseName": "Neutral Spine on Gym Ball ",
"exerciseID": "1",
"objectId": "TAwNkGHxoz",
"images": [3, 4, 5],
"tags": ["Gym Ball", "Static Control", "Lumbar ", "Thoracic Region", "Balance & Proprioception", "Core Control", "Abdominals", "Back"],
"parameters": [{
"name": "Sets",
"checked": true
}, {
"name": "Reps",
"checked": true
}, {
"name": "Weight",
"checked": false
}]
}