Skip to content

Instantly share code, notes, and snippets.

@boy-jer
Created April 18, 2013 18:49
Show Gist options
  • Save boy-jer/5415243 to your computer and use it in GitHub Desktop.
Save boy-jer/5415243 to your computer and use it in GitHub Desktop.
App.PostsController = Em.ArrayController.extend({
page: 1,
content: function loadPosts() {
return App.Post.filter({page: 1}, function() {});
}.property(),
loadMore: function() {
App.Post.find({page: this.incrementProperty('page')})
}
});
App.PostsController = Em.ArrayController.extend({
page: 0,
content: function loadPosts() {
this.loadMore();
return Em.A();
}.property(),
loadMore: function() {
App.Post.find({page: this.incrementProperty('page')}).one('didLoad', this, 'load');
},
load: function(records) {
this.pushObjects(records);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment