Commit 6a432a5

mo khan <mo@mokhan.ca>
2014-11-23 21:36:33
load more results.
1 parent 6daf303
Changed files (2)
app
routes
templates
app/routes/cakes/index.js
@@ -3,7 +3,16 @@ import Ember from 'ember';
 export default Ember.Route.extend({
   page: 1,
   perPage: 12,
+  actions: {
+    nextPage: function(){
+      this.set('perPage', this.get('perPage') + 12);
+      var that = this;
+      this.store.find('cake', { page: 1, per_page: this.get('perPage') }).then(function(cakes){
+        that.controllerFor('cakes.index').set('content', cakes);
+      });
+    },
+  },
   model: function(params) {
     return this.store.find('cake', params);
-  }
+  },
 });
app/templates/cakes/index.hbs
@@ -8,3 +8,5 @@
   {{/each}}
 </div>
 {{outlet}}
+
+<button {{action 'nextPage'}}>More...</button>