vendredi 23 janvier 2015

Ember resource reuse on router

I would like to reuse a resource under multiple routes. Here is a simplified version of my router for example purposes:



Router.map(function() {
this.resource("foo", function() {
this.resource("comments", function() {
this.route("show", {
path: ":comment_id"
});
});
});
this.route("bar", function() {
this.resource("comments", function() {
this.route("show", {
path: ":comment_id"
});
});
});
});


As expected I can now access the following urls.


/foo/comments/2


/bar/comments/2


But when I want to use transitionTo in routes I only have access to comments.show or foo.index. There appears to be no way to specify which nesting to use (foo or bar) and it just defaults to the last one defined. I really need something like foo.comments.show but there is nothing available.


Should I be doing something differently?


Thanks!





Aucun commentaire:

Enregistrer un commentaire