Rescue 2 arrays with angularjs

0

angular query

app.controller('recipedetails', function($rootScope, $routeParams, $http)
{
 $http.get('app/querys/receita_item.php?id='+$routeParams.id).success(function(data) {
  $rootScope.recipedetails = data;
  console.log(data);
 });
});

Arrays recipe_item.php

[{"id":"9","id_produto":"1","forma":"Alface","valor":"1.00","id_lanche":"3","qtd_max":"1"}]
[{"id":"41","name":"dd","value":""},{"id":"42","name":"dd","value":""}]

I need these separate arrays

$rootScope.recipedetails_one = data1; // [{"id":"9","id_produto":"1","forma":"Alface","valor":"1.00","id_lanche":"3","qtd_max":"1"}]

$rootScope.recipedetails_two = data2; // [{"id":"41","name":"dd","value":""},{"id":"42","name":"dd","value":""}]
    
asked by anonymous 05.11.2014 / 04:14

2 answers

0

It would look like this:

[
 [{"id":"9","id_produto":"1","forma":"Alface","valor":"1.00","id_lanche":"3","qtd‌​_max":"1"}], [{"id":"41","name":"dd","value":""}],
 [{"id":"42","name":"dd","value":""}] 
]

link

If it's not that I'm sorry, hugs.

    
05.11.2014 / 16:49
0

You can use the params option of the $ http method.

app.controller('recipedetails', ['$scope','$http', function ($scope,$http) {
   $http({

       url: "app/querys/receita_item.php", 
       method: "GET",
       params: {id: $scope.id}

   }).success(function(data, status) {

       $scope.recipedetails = data;

   }).;  
}]);

link . $ http # get

    
05.11.2014 / 13:26