title: Using lodash array functions on Restangular collections
body: <p>I'm using Restangular with AngularJS, and I would like to iterate over a collection in a function of the controller, where I need to modify a collection returned by Restangular:</p>
  
  <pre><code>var OrderController = [ '$scope', '$http', 'Restangular',
    function($scope, $http, Restangular) {
      $scope.orders = Restangular.all('orders').getList();
      $scope.toggleOrder = function(order) {
        _.forEach($scope.orders, function(order) {
          console.log(order); // This is not an order!
          order.someProperty = false; // My goal
        });
      });
    }];
  </code></pre>
  
  <p>I think the problem is that <code>$scope.orders</code> is a promise, not an actual array, so <code>_.forEach</code> tries to iterate on the properties of the promise instead of the objects. I get the same result with <code>angular.forEach</code>.</p>
  
  <p>How can I iterate on Restangular resource collections? I'd like to have access to all collection functions of lodash, such as <code>_.filter</code>, as well.</p>