Upon retrieving my JSON object from Firebase, I am faced with the challenge of converting a list into an array for binding in HTML using ng-repeat.
The structure of my JSON object is as follows:
{
"cats1": {
"Name": "cricket",
"imgUrl": "some url",
"list1": {
"bat": {
"Name": "bat",
"imgUrl": "some url",
"price": "$100"
},
"pads": {
"displayName": "pads",
"imgUrl": "some url",
"price": "$50"
}
}
},
"cats2": {
"Name": "football",
"imgUrl": "some url"
}
}
This is the desired array structure:
I need the data structured in this way to ensure that when adding new items, they are uniquely stored under the cricket category.
[
{
"Name": "cricket",
"imgUrl": "some url",
"list1": [
{
"Name": "bat",
"imgUrl": "some url",
"price": "$100"
},
{
"displayName": "pads",
"imgUrl": "some url",
"price": "$50"
}
]
},
{
"Name": "football",
"imgUrl": "some url"
}
]
I am relatively new to Angular and would appreciate any assistance in resolving this issue.