Reputation: 149
I am making a simple todo list in Ember using the Ember cli, and I am running into some confusion with the folder structure and code that is getting auto generated.
In my routes folder I have a items.js that defines the model to be rendered to the template and it works fine. But in the console is telling me that it is auto generating an route:items.index
generated -> route:items.index Object {fullName: "route:items.index"}
I added the items folder to the routes folder and an index.js to the items folder. Which clears up that console line. But it doesn't actually affect anything. I can console log out from it, but setting the model to return different data doesn't change what is displayed at /items. If I then try removing my routes/items.js and run it. I tells me that it is auto generating that file, but nothing displays, because it still doesn't use items index
generated -> route:items Object {fullName: "route:items"}
Can anyone explain what is happening here, what is the difference between routes/items and route/items/index ? Why does it need both, and why does the app completely ignore the latter.
Any insights would be greatly appreciated.
Upvotes: 0
Views: 112
Reputation: 47367
It's a route under your item's resource. Add {{outlet}}
to your item's template, and then create a new template items/index
and put some random text in it. You'll see when you're on the items
resource /items
and only the items
resource it will render the index
template. This is a way of rendering something special when they hit the root of a particular resource and no deeper.
Upvotes: 1