1

I am looking at the firetube example and would like to make a change to the limit after a button is pressed, For example a load more button is pressed and a fucntion is called in the firetube.js file. Which needs to increase the query limit so that more items are displayed. How do I go about that? Below is the code I have:

var commentLimit = 10;

    //Create a query for only the last 10 comments
var last10Comments = commentsRef.limit(commentLimit);

//Render Comments
last10Comments.on('child_added', function (snapshot) {
  var comment = snapshot.val();
  var newDiv = $("<div/>").addClass("comment").attr("id",snapshot.name()).appendTo("#comments");
  FB.api("/" + comment.userid, function(userdata) {
    comment.name = userdata.name;
    newDiv.html(Mustache.to_html($('#template').html(), comment));
  });
});

And the load more function:

function loadMoreClicked() {
  commentLimit = commentLimit + 10;
  commentsRef = new Firebase(firebaseURL);
  last10Comments = commentsRef.limit(commentLimit);
}
Tanner Ewing
  • 337
  • 4
  • 18
  • This might give you some ideas http://stackoverflow.com/a/22886527/3366109 – Jobsamuel May 23 '14 at 14:50
  • possible duplicate of [Infinite scroll with AngularJs and Firebase](http://stackoverflow.com/questions/22868604/infinite-scroll-with-angularjs-and-firebase) – Kato May 27 '14 at 16:52

0 Answers0