Right, I'm using $resource and query to access a RESTful interface which gives a response in the following format:
record (array[RecordResponse], optional)
eg:
{
"record": [
{
"countryID": 732,
"countryName": "Western Sahara",
"countryISO": "EH",
"countryISO3": "ESH"
},
{
"countryID": 4,
"countryName": "Afghanistan",
"countryISO": "AF",
"countryISO3": "AFG"
},
{
"countryID": 8,
"countryName": "Albania",
"countryISO": "AL",
"countryISO3": "ALB"
}
]
}
my current $resource query looks like this:
return $resource('http://mydatasource/countries?fields=countryID%2CcountryName%2CcountryISO%2CcountryISO3', {}, {
query: {method:'GET', isArray:false}
})
In my controller I get access the resource using:
$scope.places = Countries.query();
Which I can then put in a nice list in my view and do stuff, for example:
<tr ng-repeat="country in places.record">
<td>{{country.countryName}}</td>
</tr>
Great no problems there!
However, I'm running in to problems when I'm trying to perform filters etc with the returned data in the controller. I need to get the JSON objects out of the records array but I'm not sure how to do that outside of the view!
Any pointers would be much appreciated.
Thanks