I am working on an Angular test application where I am trying to retrieve data from a PHP page into my model. The response comes using the echo json_encode($arr);
command in the PHP file and has the format
[{"id":"1","name":"first","text":"description"}]
. To successfully receive this data in my model, I have to use a query because .get is giving me an error. In my controller, my query looks like this:
$scope.item = Items.query({id:$routeParams.id});
When trying to use this data in my model, I need to specify my array item[0].name, which is not a problem. However, when attempting to save edited data, I encounter an error:
$scope.item[0].$save({id:$scope.item[0].id});
The error message I receive is TypeError: Object # has no method 'push'
What could I be doing wrong?