Hi,
The ngResource API makes the assumption that the elements it is handling
are objects, not strings. When ngResource receives a string, it tries to
transform it to an object the best way it possible, so it is converted to
the object you are seeing.
Regards,
Lucas
On Friday, December 20,
Reading json arrays works fine with $http.
$http({method: 'GET', url: '/url'}).
success(function(data) {
console.log(angular.toJson(data));
});
But i still cant get $resource to work. Feels like a bug, but I cant really
tell?
Any help? Pointers? Someone else who got $resource to work fo
Yes, sorry, but I cannot post the server code and the client code is really
that simple.
It works fine if i wrap the response in an object, but a pure array gives
me this wired behaviour.
The raw response looks like this in tcpflow.
Content-Type: application/json
Transfer-Encoding: chunked
Ser
Hi Kristoffer,
It is hard to tell what's going on without an working sample demonstrating
the issue.
My guess is that the server isn't giving you the response, you expect.
I looks the server is giving back an text only response. Did you take a
look at the network tab in the debugger?
Regards
S
js:
$scope.values = $resource(url).query();
html:
{{values}}
On Thursday, December 19, 2013 5:16:58 PM UTC+1, Charly Román wrote:
>
> I don't see your code.
>
> 2013/12/19 Kristoffer Sjögren >:
> > Hi
> >
> > When I use $resource(url).query() to fetch an array of strings angular
> seems
I don't see your code.
2013/12/19 Kristoffer Sjögren :
> Hi
>
> When I use $resource(url).query() to fetch an array of strings angular seems
> to think its a list of characters and prints something like this:
>
> [{"0":"p","1":"a","2":"g","3":"e","4":"V","5":"i","6":"e","7":"w"},{"0":"n","1":"e","
Hi
When I use $resource(url).query() to fetch an array of strings angular
seems to think its a list of characters and prints something like this:
[{"0":"p","1":"a","2":"g","3":"e","4":"V","5":"i","6":"e","7":"w"},{"0":"n","1":"e","2":"w","3":"S","4":"e","5":"s","6":"s","7":"i","8":"o","9":"n"}]