Skip to content

Instantly share code, notes, and snippets.

@tarzak
Last active August 29, 2015 14:10
Show Gist options
  • Save tarzak/e1b643a9376ed96aa3c1 to your computer and use it in GitHub Desktop.
Save tarzak/e1b643a9376ed96aa3c1 to your computer and use it in GitHub Desktop.
PostsListController = RouteController.extend({
template: 'postsList',
increment: 5,
limit: function() {
return parseInt(this.params.postsLimit) || this.increment;
},
findOptions: function() {
return {sort: {submitted: -1}, limit: this.limit()};
},
waitOn: function() {
return Meteor.subscribe('posts', this.findOptions());
},
data: function() {
return {posts: Posts.find({}, this.findOptions())};
}
});
@tarzak
Copy link
Author

tarzak commented Dec 3, 2014

Рассмотрим код. Сначала мы создали контроллер наследуя его от RouteController. Затем был инициализирован параметр template, а также новый параметр - increment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment