Reputation: 107
Apollogies for my english,
I have a router like this :
App.Router.map ()->
@resource 'movies' , ->
@route 'free'
@route 'featured'
@route 'index'
@route 'movie', path: '/:movie'
@resource 'seasons' , ->
@route 'free'
@resource 'featured', ->
@route 'season', path : '/:season'
@route 'index'
@route 'season', path: '/:season'
In this particular case:
@resource 'seasons' , ->
@route 'free'
@resource 'featured', ->
@route 'season', path : '/:season'
If a do a :
{{#linkTo "seasons.featured.season" 25}} ....
Ember throws an exception. I have to do :
{{#linkTo "featured.season" 25}} .... // this way is ok
The same with the templates. I Have to put in the path:
/templates/featured/seasson.hbs // ok
Instead of how i think should be the correct path:
/templates/seasons/featured/seasson.hbs // worng
Is this the correct way ??
Thanks in advance
Upvotes: 0
Views: 124
Reputation: 11668
Yes, this is the correct way. Have a look at this part of the router guide. If you nest resources
, the path of the route is "reset".
The following example is from the guide:
App.Router.map(function() {
this.resource('post', { path: '/post/:post_id' }, function() {
this.route('edit');
this.resource('comments', function() {
this.route('new');
});
});
});
You would link the new route for comments like this:
{{#linkTo "comments.new"}}
Accordingly the template would have to be named comments/new
.
But if you wish, you can preserve the namespacing, which is also explained in the guide:
App.Router.map(function() {
this.resource('foo', function() {
this.resource('foo.bar', { path: '/bar' }, function() {
this.route('baz'); // This will be foo.bar.baz
});
});
});
Now the full route name of baz is foo.bar.baz
and the template would have to be placed in foo/bar/baz
.
Upvotes: 1