This is strange data to get back! :)

If the numbers are always sequential then you can do this 
: http://jsfiddle.net/AwxWQ/2/
However I would fix the end point instead...

Regards,

Garry Taylor

On Monday, 19 May 2014 16:51:43 UTC+1, Juan Manuel Garcia Olivares wrote:
>
> I have this code.
>
> AngularJS factory
>
>     .factory('Suggest', ['$resource',
>        function($resource){
>      return $resource(baseUrl+'/suggest', {}, {
>      query: {
>      method:'GET',
>      isArray: true
>      }
>      });
>     }
>     ]);
>
> Controller
>
>     .controller("SearchFormController", function($scope, $http, Suggest) {
>         Suggest.query(
>          function(data) {
>          $scope.suggestions = data;
>         }
>         );
>         ...
>     });
>
>
>
> And the WebService that respond this structure when I hit baseUrl/suggest
>
> [
> "0 800",
> "0800 atencion al cliente",
> "19114",
> "19116",
> "2 x 1",
> "30201001992029174",
> "a donde tengo que enviar el mensaje para comprar un paquete de mensajes",
> "a que velocidad navego",
> "abono",
> "abonos",
> "acceder",
> "acceder a mi cuenta",
> "activacion",
> "activacion chip",
> "activacion de chip",
> "activacion de linea",
> "activar",
> "activar chip"
> ]
>
>
> ## The problem ##
>
> I'm using an [autocomplete library][1] who needs the $scope.suggestions as 
> an array.
> The problem here is that i'm getting (for some reason that I don't know) a 
> serialized version of the array content, like this
>
> for "a donde tengo que enviar el mensaje para comprar un paquete de 
> mensajes"
> i get
>
>     {"0":"a","1":" ","2":"d","3":"o","4":"n","5":"d","6":"e","7":" 
> ","8":"t","9":"e","10":"n","11":"g","12":"o","13":" 
> ","14":"q","15":"u","16":"e","17":" 
> ","18":"e","19":"n","20":"v","21":"i","22":"a","23":"r","24":" 
> ","25":"e","26":"l","27":" 
> ","28":"m","29":"e","30":"n","31":"s","32":"a","33":"j","34":"e","35":" 
> ","36":"p","37":"a","38":"r","39":"a","40":" 
> ","41":"c","42":"o","43":"m","44":"p","45":"r","46":"a","47":"r","48":" 
> ","49":"u","50":"n","51":" 
> ","52":"p","53":"a","54":"q","55":"u","56":"e","57":"t","58":"e","59":" 
> ","60":"d","61":"e","62":" 
> ","63":"m","64":"e","65":"n","66":"s","67":"a","68":"j","69":"e","70":"s"} 
>
>
> **How can I transform this serialized data to string?**
>
>   [1]: https://github.com/JustGoscha/allmighty-autocomplete
>

-- 
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/d/optout.

Reply via email to