Is there a way to retrieve data from a JSON file with the following structure?
{"employees":[
{"firstName":"John", "lastName":"Doe"},
{"firstName":"Anna", "lastName":"Smith"},
{"firstName":"Peter", "lastName":"Jones"}
]}
Here is the script being used:
phonecatApp.controller('PhoneListCtrl', ['$scope', '$http', function($scope, $http) {
$http.get('employees/employees.json').success(function(data) {
$scope.resources = data;
});
If I remove the "employees" key and only have the attributes inside the [], I can access my data. However, if it's structured like the example above, I'm unable to reach the data.
Any assistance would be greatly appreciated.