I'm still new to Ember.js. The Nested Resources example states the following:
URL: /post/:post_id/comments/new
Route Name: comments.new
Controller: App.CommentsNewController
Route: App.CommentsNewRoute
Given this:
Thank you!
Edit: This question is about Ember Pre4.
It's because post is a resource, comments is a resource, whilst new is a route. The path for the route begins at the last resource name, in this case comments. I perceive this as a problem, as you've addressed in the second question, so I expect this to change to be PostCommentsNewController.
You don't disambiguate between them at the moment, but expect this to be in pre 5.
There's no need to specify a templateName unless you're inserting views manually. For /#/pets Ember will first consult App.PetsRoute, locate/instantiate App.PetsController, and instantiate App.PetsView. App.PetsView will be inserted into a template which has a data-template-name of "pets".
Question 3: The TemplateName to be rendered for a route can be set by using the this.render-method documented here:
http://emberjs.com/guides/routing/rendering-a-template/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With