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, 2013 11:10:41 AM UTC-3, Kristoffer Sjögren wrote:
>
> 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 for plain
> arrays?
>
> On Thursday, December 19, 2013 10:17:08 PM UTC+1, Kristoffer Sjögren wrote:
>>
>> 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
>> Server: Jetty(9.0.4.v20130625)
>>
>> 327
>> ["pageView","newSession"]
>>
>>
>> The network tab in Chrome.
>>
>> ["pageView","newSession"]
>>
>>
>> On Thursday, December 19, 2013 9:25:43 PM UTC+1, Sander Elias wrote:
>>>
>>> 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
>>> Sander
>>>
>>
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/groups/opt_out.