Meteor Pagination with alethes:pages -


i'm using alethes:pagination don't understand how make work. have 4 posts in collection , want display 2 per page. here's code.

app.js

blogposts = new mongo.collection("blogposts");  if (meteor.isclient) {     template.body.helpers({         blogposts: function() {             return blogposts.find({});         }     }); }  pages = new meteor.pagination(blogposts, {     itemtemplate: "post",     perpage: 2 }); 

app.html

<head>   <title>pagination</title> </head>  <body>     {{> pages}}     {{> pagesnav}} </body>  <template name="post">     {{title}} </template> 

you have provide 2 templates name alethes backed collection.

one page itself, , items of paginated content.

in js

paginatedstuff = new meteor.pagination(polls, {   perpage:6,   templatename: 'paginatedstuff',   itemtemplate: 'stufflistitem' }); 

where want have paginated content :

{{>paginatedstuff}} 

and 2 templates

<template name="paginatedstuff">     {{> pages}}      {{> pagesnav}}<!-- bottom navigation --> </template>  <template name="stufflistitem">     <!-- stuff display item here --> </template> 

Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -