With the following code, I am fetching a list of 'postrows':
$scope.postrows = {};
Restangular.all('/postrows').getList().then(function(data){
$scope.postrows = data;
});
The returned JSON structure is as follows:
{
id: 1,
post: {
id: 1,
postcategory: 1,
account: "0005",
description: "Grond",
sequence_number: 1
},
amount: 2343.56,
},
However, when looping through the list of items:
angular.forEach($scope.postrows, function(postrow) {
console.log(postrow);
console.log(postrow.post);
}
When trying to access postrow.post
, the Restangular function post
is retrieved instead of the object from the JSON file. How can I access the actual post
object without changing its name?
Note that renaming post
is not an option.