Re: [AngularJS] Array of strings treated as arrays of chars

2013-12-23 Thread Lucas Galfaso
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,

Re: [AngularJS] Array of strings treated as arrays of chars

2013-12-20 Thread Kristoffer Sjögren
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

Re: [AngularJS] Array of strings treated as arrays of chars

2013-12-19 Thread Kristoffer Sjögren
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

Re: [AngularJS] Array of strings treated as arrays of chars

2013-12-19 Thread Sander Elias
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

Re: [AngularJS] Array of strings treated as arrays of chars

2013-12-19 Thread Kristoffer Sjögren
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

Re: [AngularJS] Array of strings treated as arrays of chars

2013-12-19 Thread Charly Román
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","

[AngularJS] Array of strings treated as arrays of chars

2013-12-19 Thread 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","2":"w","3":"S","4":"e","5":"s","6":"s","7":"i","8":"o","9":"n"}]