The following JSON response from the server
[
\"hello\",
\"world\"
]
is being parsed into a 2d array by this ngResource service
I have been struggling with this as well. Here is my solution by adjusting the service slighly by using query
var app = angular.module('testApp', ['ngResource']);
app.factory('Name', function($resource, $sce) {
var path = "test.json";
return $resource(path, {}, {
query: {
method: 'GET',
isArray: false
}
})
});
app.controller('testController', function($scope, Name) {
$scope.result;
$scope.getResult = function() {
Name.query(function(data) {
$scope.result = data;
});
};
$scope.getResult();
});
HTML:
{{result.surname}}
and the JSON file:
{
"name": "Homer",
"surname": "Simpson",
"Town": "Springfield"
}
and also working Plunker if interested: http://plnkr.co/edit/SwqlZyqZ4zfcpaLxaf39
Hope this help someone ...