vendredi 15 janvier 2016

Ember hide parent template when viewing sub-route

I am making a simple blog for my website with Ember.

My routes:

Router.map(function() {
  this.route('home', { path: '/' });
  this.route('blog', function() {
    this.route('post', {path: '/:post_id'});
  });
});

I want it so when I click on a post in /blog and wind up at /blog/:post_id I hide the content of the blog.hbs file and only show the blog/post.hbs content.

I tried specifying the render template explicitly in my post.js route file, but things kept working in the same fashion.

export default Ember.Route.extend({
  model: function(params) {
    return this.store.findRecord('post', params.post_id, { reload: true });
  },
  renderTemplate: function() {
    this.render('blog/post');
  }
});

Reading through the documentation here didn't cue me into any other ideas.

http://ift.tt/1RpPwql

Am I fundamentally using Ember wrong? Should my post URL not be a sub-route of Blog if I want to hide a parent templates content?




Aucun commentaire:

Enregistrer un commentaire