I am currently working on creating a status list that pulls data from two separate JSON sources. The main purpose of this list is to show general information from the first source, while also indicating a status color based on the number of people in the second source.
The first JSON source contains static data such as feed name, version, and description, which will only be updated twice a day. Here is an example of the code:
/metadata
{
data: [
{
"feedName": "Feed 1",
"version": "000001",
"location": "1234 Main Street, New York, New York"
"description": "This feed provides information about the number of individuals in Building A at any given time."
},
{
"feedName": "Feed 2",
"version": "000001",
"location": "1000 Broad Street, New York, New York"
"description": "This feed provides information about the number of individuals in Building B at any given time."
},
{
"feedName": "Feed 3",
"version": "000001",
"location": "1111 Governor Street, New York, New York"
"description": "This feed provides information about the number of individuals in Building C at any given time."
}
]
}
The second JSON source contains dynamic data for each feed that changes frequently and needs to be updated every hour.
/customers
{
data: [
{
"metricName": "Feed 1",
"customerNumber": "10",
"time": "2012-10-03 15:30:00"
},
{
"metricName": "Feed 2",
"customerNumber": "5",
"time": "2012-10-03 15:30:00"
},
{
"metricName": "Feed 3",
"customerNumber": "15",
"time": "2012-10-03 15:30:00"
}
]
}
Where both metricName and feedName have the same values.
In previous cases, I have only worked with one JSON source per list. However, now I need to figure out how to make asynchronous calls to each data source and then match up the data to populate my list with information from both metadata and customers.
Update I did try using
ng-repeat = "data in metadata.concat(customers)"
approach as referenced in this Stack Overflow thread, but it didn't provide the desired result. It simply appended the data to the end of the list.
Any suggestions or guidance on this matter would be greatly appreciated. Thank you!