Restangular.all('orders').getList()
- is a promise, not array.
Assign your list using $object
:
$scope.orders = Restangular.all('orders').getList().$object;
List will be an empty array until request is complete.
UPDATE full code for question (includes orders modification on request complete)
$scope.orders = [];
function modifyOrders(orders){ ... }
Restangular.all('orders').getList().then(function(orders){
modifyOrders(orders);
$scope.orders=orders;
});
$scope.toggleOrders = function(toggledOrder){
_.forEach($scope.orders, function(order) { ... });
};