Server response an array data in JSON format:
["2345","1234"]
Angular service module define:
angular.module('MySource', ['ngResource']).factory('Phone', function($resource){
return $resource('/api/source');
});
Then I use Phone.query();
to fetch array data, but got this:
[{"0":"2","1":"3","2":"4","3":"5"},{"0":"1","1":"2","2":"3","3":"4"}]
But $http
works:
$http.get('/inner/source').success(function(data){
// data = ["2345", "1234"]
});
What's the problem? Why $resource
split the array? Does I use $resource
wrong way?
Thanks.