Transform object in array


#1
 socket.on('test-channel:Comanda\\Events\\EventName', function (message) { 
                $scope.mesa = message;
                console.log($scope.mesa);
            });


#2

try $scope.mesa = message.data


#3

try $scope.mesa = message.data;

$scope.mesa = message.data;

Thanks for replying but I tried the 2 ways and still get errors


#4

$scope.mesa = message.data; you tried this and got clientOrderCtrl not defined??

try $scope.mesa = message.data and console.log($scope.mesa);

in your console [assuming that you have done console.log(message) ] you have an object with property data and value of data is an array. thats the reason i told you to use message.data.


#5

"collection-repeat expected an array for 'mesa' "
and the array is in the the response.data.data in your case:

so try : $scope.mesa = message.data.data;
and it will work fine.


#6

thanks for help problem was solved


#7

glad I could help :slight_smile: