Reputation: 10726
I'm trying to use the new Router API (at commit 6a165ad), and I have some problems.
Given this router:
Router.map(function(match) {
match("/posts").to("posts", function(match) {
match("/new").to('new', function(match) {
match("/author").to('author');
});
});
});
I'm trying to transition to the new
route.
Using new.index: this.transitionTo('new.index')
It works, but as you can see the route name is not really explicit (we don't even know that it's for a new post). It's consequently not a viable solution.
Using posts.new: this.transitionTo('posts.new')
I hoped it works, but an error is thrown:
The route
posts.new
was not found.
I believed the transition to the index was made automatically, but it seems not.
Using customized route name:
Since the commit specified above, Ember allows custom route naming. As my previous attempt does not work, I tried to force the new
route to be posts.new
, but it still does not work (idem if it was foo.new
).
It looks like its not possible to go to a customized route that has nested routes.
new
route (and specifying posts
). How should it be done ?to
(i.e. match("/posts", function(match) { ... })
), is it still working ? If so, what's the name of its children ?Upvotes: 0
Views: 342
Reputation: 28703
This was actually a bug in Ember. Because index
is implicit, you should not need to explicitly provide it.
The bug was fixed on master.
If you want to go to a route that has child routes, you should transitionTo
the specified name of the route, and Ember will automatically add the index
for you.
Upvotes: 1