How to get a trace route to load correctly in Ember.js?

I have a route in #/posts for posts that show the first page of posts, and a pagination route in #/posts/:page_id that shows any page you request. My router looks like this:

 App.Router.map(function(match) { //... this.route('posts'); this.resource('postsPage', { path: '/posts/:page_id' }); }); 

And these routes look like this:

 App.PostsRoute = Em.Route.extend({ model: function(params) { return App.store.find(App.Post, { 'page': params.page_id }); } }); App.PostsPageRoute = Em.Route.extend({ renderTemplate: function() { this.render('posts'); }, model: function(params) { return App.store.find(App.Post, { 'page': params.page_id }); } }); 

This worked fine about a month after I implemented it, but recently it has stopped working for anything other than the #/posts route. Pages do not load, although my REST API returns the right JSON.

Feed here
#/posts route here
#/posts/1 route here (note that it doesn't load content even if JSON is sent)

+4
source share
1 answer

By default, postPageRoute will configure the postsPage controller. You must tell him to configure the message controller.

 App.PostsPageRoute = Em.Route.extend({ setupController: function(controller, model) { this.controllerFor('posts').set('content', model) }, renderTemplate: function() { this.render('posts'); }, model: function(params) { return App.store.find(App.Post, { 'page': params.page_id }); } }); 
+3
source

All Articles