title: Problems using defer & $loaded to retrieve the items a user has bookmarked
body: <p>I am having trouble displaying the items a user has bookmarked.</p>
  
  <p>The code to get the bookmarks is as follows:</p>
  
  <pre><code>app.factory('API', function($firebaseArray, $firebaseObject, FBURL, $q) {
    var ref = new Firebase(FBURL);
  
    /* 
    Called to retrieve the list of items bookmarked
    */
  
    API.getBookmarks = function(userID) {
      var defer = $q.defer();
      var query = ref.child('Users').child(userID).child('bookmarkedItems');
      $firebaseArray(query).$loaded(function(data) {
        var bookmarks, i, itemKey;
        i = 0;
        bookmarks = {};
        while (i &lt; data.length) {
          itemId = data[i].$id;
          bookmarks[itemKey] = API.getSingle(itemId);
          i++;
        }
        defer.resolve(bookmarks);
      });
      return defer.promise;
    };
  
    /* 
    Called to retrieve the items in the bookmark list 
    */
  
    API.getSingle = function(itemId) {
      var defer = $q.defer();
      var query = ref.child('Items').child(itemId);
      $firebaseObject(query).$loaded(function(data) {
        defer.resolve(data);
      });
      return defer.promise;
    };
    return API;
  });
  </code></pre>
  
  <p>The trouble is that API.getBookmarks('someUserId') is returning me a list of promises attached to each item.$id instead of the items' data. So, the problem arises from my use of asycnhronous functions, but it appears that I am using defer and $loaded in the proper places to deal with these issues. </p>
  
  <p>Does anyone have an idea of how to fix it?</p>
  
  <p>Also, not entirely relevant, but I want to note that this operation worked perfectly fine before I just updated from AngularFire 0.9x to 1.1.1, and the <a href="http://www.firebase.com/docs/web/libraries/angular/changelog.html" rel="nofollow">changelog</a> notes some issues with the firebaseArray $loaded function resolving before it should.</p>