Skip to content

Instantly share code, notes, and snippets.

@chrisjlee
Forked from alexspeller/route.coffee
Created August 18, 2014 16:31
Show Gist options
  • Save chrisjlee/77aa23b4a6032aa502e4 to your computer and use it in GitHub Desktop.
Save chrisjlee/77aa23b4a6032aa502e4 to your computer and use it in GitHub Desktop.
Filter route example with pagination
App.FilteredRoute = Em.Route.extend({
page: 1,
query: null,
model: function() {
return this.store.find('something', {
page: this.page,
query: this.query
});
},
actions: {
nextPage: function() {
this.page += 1;
return this.refresh();
},
previousPage: function() {
this.page -= 1;
return this.refresh();
},
query: function(string) {
this.query = string;
return this.refresh();
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment