title: Loop through array?
body: <p>In an Angular app, I have made a factory, where I get all my products and put them into a factory variable. From there I can get grab them, wherever I need them. So far s good.
  I then want to manually loop through all the items in the products array. I have tried the following;</p>
  
  <p>My factory first</p>
  
  <pre><code>myApp.factory('myStore', function ($http, $q, Store) {
      var products = "";
  
      // Bind products
      products = Store.query();
  
      return {
          get: function () {
              return products;
          },
          getSingle: function(id) {
          },
          set: function (data) {
              products = data;
          },
          add: function (data) {
  
          }
      };
  });
  </code></pre>
  
  <p>In my controller i have</p>
  
  <pre><code>// Bind products to list
  vm.products = myStore.get();
  console.log(vm.products);
  for (var prop in vm.products) {
      // returns just 2 objects?
      console.log(prop);
  }
  
  for (i = 0; i &lt; vm.products.length; i++) {
      // Does not wok at all?
  }
  
  vm.products.forEach(function (child) {
      // Does not work either. Simply does nothing.
  });
  </code></pre>
  
  <p>What do I need to do to iterate through my array?</p>
  
  <p>The returned products are in the correct format, and the correct values.</p>
  
  <p>What gives?</p>
  
  <p>The resource:</p>
  
  <pre><code>myApp.factory('Store', function ($resource) {
      return $resource('http://api.com/api/products/:id', { id: '@id' }, {
          update: {
              method: 'PUT'
          }
      });
  });
  </code></pre>
  
  <p>The output from console.log(vm.products): <a href="http://screencast.com/t/Q52EJ2F7gf" rel="nofollow">http://screencast.com/t/Q52EJ2F7gf</a></p>