Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 70612

Infinite scroll using firebase snapshot

$
0
0

@outfitpic wrote:

I am trying to figure out how to use ionic infinite scroll using firebase data snapshot so I can retrieve images associated with the user.

Here is my code to get the snapshot. How can I call it so it loads only 4 at a time?

   getWardrobeFeed: function(){
      var defered = $q.defer();
      var user = User.getLoggedInUser();
      var wardrobeKeyRef = new Firebase(FIREBASE_URL + '/userProfile/' + user.uid + '/wardrobe');
      wardrobeKeyRef.orderByChild('timestamp').limitToLast(2).on('child_added', function (snap) {
        var imageId = snap.key();
        userImageRef.child(imageId).on('value', function (snap) {
          $timeout(function () {
            if (snap.val() === null) {
              delete userWardrobeFeed[imageId];
            } else {
              userWardrobeFeed[imageId] = snap.val();
            }
          });
        });
      });
      wardrobeKeyRef.orderByChild('timestamp').limitToLast(2).on('child_removed', function (snap) {
        var imageId = snap.key();
        $timeout(function (snap) {
          delete userWardrobeFeed[imageId];

        });
      });
      //return ;
      defered.resolve(userWardrobeFeed);
      start = start + n;
      end = end + n;
      return defered.promise;
    }

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 70612

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>