Skip to content

Instantly share code, notes, and snippets.

@alexspeller
Forked from bricker/router.js
Last active December 20, 2015 21:28
Show Gist options
  • Save alexspeller/6197695 to your computer and use it in GitHub Desktop.
Save alexspeller/6197695 to your computer and use it in GitHub Desktop.
ArticlesRoute = Em.Route.extend({
model: function() {
Article.find({page: 1});
return Article.all();
}
});
ArticlesController = Em.ArrayController.extend({
currentPage: 1,
loadMore: function() {
this.incrementProperty('currentPage');
},
articleLoader: function() {
Article.find({page: this.get('currentPage')});
}.property('currentPage')
isLoadingBinding: 'articleLoader.isLoading'
})
In the template:
<span {{action prevPage}}>Previous Page</span>
<span {{action nextPage}}>Next Page</span>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment