Reputation: 11
I am referring to the basic demo of Meteor-Pages.
Basic demo https://github.com/ianpogi5/meteor-pages/tree/master/examples/basic.
Meteor-pages https://atmospherejs.com/package/pages.
The idea is to create pagination and show 1 recommendations at each page.
Nothing shows up at the browser and I encountered these errors :
Uncaught TypeError: Cannot set property 'pagesData' of undefined
Exception from Deps recompute function: Error: Expected null or template in return value
from inclusion function, found: [object Object]
My codes are :
pages.coffee
@Pages = new Meteor.Pagination 'Recommendations',
perPage: 1
recommendations.coffee
@Recommendations = new Meteor.Collection("recommendations")
recommendations_list.html
<template name="recommendationsList">
<h1>Recommendations for each user</h1>
<div>
{{#each recommendations}}
{{> recommendationItem}}
{{/each}}
</div>
{{> recommendations}}
</template>
<template name="recommendations">
{{> pagesNav}}
{{> pages}}
</template>
Upvotes: 0
Views: 327
Reputation: 11
Solved, there are two things that I have did wrong with the previous code. Below is the amended one.
recommendations.coffee
@Recommendations = new Meteor.Collection("recommendations")
// Pagination must put directly under the collections, because we want to run the
// collection first before making the pagination
@Pages = new Meteor.Pagination Recommendations,
perPage: 1
recommendations_list.html
<template name="recommendationsList">
<h1>Recommendations for each user</h1>
<div>
{{> recommendations}}
</div>
</template>
<template name="recommendations">
{{> pagesNav}}
{{> pages}}
</template>
Upvotes: 1