Infinite Scroll: Using templates and handlebars


#1

Anyone has tried to use infinite scroll with templates that contains handlebars?

in my case this does not work and error on console:

my code when loadMore

  loadMore: function () {
    var self = this;
    var $ = self.$$;
    if (!self.allowInfinite) return;
    self.allowInfinite = false;

    setTimeout(function () {
      if (self.lastItem >= 200) {
        $(self.$el).find('.preloader').remove();
        return;
      }
      var tmpl = '';

      for (var i = 1; i <= 5; i++) {
        var tmpl = '{{#slice hotels.hotels offset="5" limit="1"}}{{hotelname}}{{/slice}}';
      }

      $(self.$el).find('#hotels').append(Template7.compile(tmpl));

      self.lastItem += 5;

      self.allowInfinite = true;
    }, 1000);
  },