From publication i am setting an argument called limit. and this is my controller
MainPageController = BaseController.extend({
findOptions: function() {
return {sort: {createdAt: 1}};
},
waitOn: function() {
return Meteor.subscribe("allCars",5,this.findOptions());
},
data: function(){
return {cars: Cars.find({},this.findOptions() )};
}
});
in my Template i have a button on click of which i want to load the next 5 records. my helpers are in different file. how can i implement this infinite scrolling. please help
Publication
Meteor.publish('allcars', function(limit){
return Jobs.find({}, {limit: limit});
});
then i am setting a default session variable for it
Template.jobsList.onCreated(function(){
Session.setDefault("carsLimit",5);
});
after this in the helper i am very confused and its a whole lot of mess i have done.
and this is my template
<div class="col s12">
<ul class="cars-list">
{{#each allCars}}
<li>
{{> carItem}}
</li>
{{/each}}
</ul>