mercredi 28 janvier 2015

Ember claims that route that doesn't exist is rendered

I have following Route.mapping



App.Router.map(function() {
this.resource("topic", {path: "topic/:id"}, function () {
this.route("section", { path: "/section/:section_id" });
});
this.resource("topics", {path: "topics/:id"});
});


and my /templates/-folder structure is as such:



templates/
|--topic/section.hbs
|topics.hbs
|topic.hbs


In topics.hbs, I use {{link-to}} helper to link-to the correct topic.section



{{#link-to 'topic.section' section}} {{section.title}} {{/link}}


When I click the link, Ember LOG_TRANSITIONS states that I have


Transitioned into 'topics.topic.section'


That route doesn't exist though (or does it??). Nothing related to App.TopicsTopicSectionRoute never fires, but App.TopicSectionRoute does, which I use to render the template topic.section over the the topics one:



renderTemplate: function () {
this.render('topic.section', {
into: 'application',
outlet: 'main'
});
}


Which sort of works, but it causes other issues along the line. My question is, how can I make that {{link-to}}-helper enters the correct route topic.section instead of topics.topic.section? Am I missing something obvious?





Aucun commentaire:

Enregistrer un commentaire