Last active
August 29, 2015 14:10
-
-
Save tarzak/e1b643a9376ed96aa3c1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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())}; | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Рассмотрим код. Сначала мы создали контроллер наследуя его от RouteController. Затем был инициализирован параметр template, а также новый параметр - increment.