I've recently started using Ember.js with Ember-CLI and I'm pretty excited. But there are some things that are not clear for me.
Here is my router:
this.resource("authenticated", { path: '/' }, function() {
this.resource("contacts", function() {
this.resource("contact", { path: ':id' });
});
this.resource("chats", function() {
this.resource("chat", { path: ':id' });
});
this.resource("settings", function() {
this.resource("setting", { path: ':id' });
});
});
The question is - why after 2nd nesting 'resolver' starts finding objects outside of 'authenticated' resource?
For example
my-app/pods/chats/index/view
But expected my-app/pods/authenticated/chats/index/view
Why is 'authenticated' missed ?
Your authenticated route is not applied in the url because you assigned it's url to the root:
{ path: '/'}.You should either change the path to 'authenticated' or remove it all together:
this.resource("authenticated", function() { ... });Now, however, authenticated is only rendered when a user navigates to
my-app/pods/authenticated. If you still want to render authenticated as index, you should prefix your nested resources:I hope this helped you.