Nested UI, Routes and Resources: Pro and Con


Attempting to create a long running thread about nested routing and all the related issues with this in ember. Want to collect all the relevant info in one place and hopefully produce an in-depth guide on the topic, after I can separate bugs from expected behavior, and undefined behaviors.

I started learning Ember JS and I took the following quote to heart:

“If your user interface is nested, your routes should be nested” – Yehuda Katz

Well this has been very frustrating in practice. After reading the guides and numerous blogs and stack overflow questions and trying to understand the latest router changes, my understanding seems more muddled than ever. I am not willing to drop ember, but I thought I could start this thread to consolidate ideas on the topic of nested UI design from both a practical and theoretical perspective. Perhaps others reading this thread will find some of the answers (and non-answers) quicker than I did.

It seems there is definitely something limited in the way resources and nesting work within ember or else there are conventions and reasonable design decisions that are not as obvious as they could be. To that end I would like to explore why that is in this thread. And also use this thread to provide links to practical examples of nested UI and idiomatic ember (jsBin etc).

I plan to come back to this thread as I can to post useful links and references. I would encourage others to do the same.

Related threads:

Querystring Support in Ember

A related topic especially when a UI design requires deeply nested and dynamic segments in router structure.


A naive approach to nesting that doesn’t work but not sure why


To what extent does ember js support deeply nested UIs and what are some explicit design decisions in ember that may limit how deeply one can nest resources in the router and UI?

PS: If it seems like I am spamming the forum, that is not my intention. I would like to use this thread to gather together bunch of information and perhaps then take a stab at writing an official guide on the topic once I cement enough knowledge in my mind.

More Questions

What is general meaning of this error and what specific causes it to arise?

Uncaught Error: More context objects were passed than there are dynamic segments for the route:


I’ll have a fuller response shortly, but you are in no way spamming the forum :slight_smile: This seems quite constructive.

More naive nesting code…

Why does this JS Bin raise an error when navigating to the route

Uncaught Error: More context objects were passed than there are dynamic segments for the route:

Trying to make an analogue for solution.index neither yet seem to load model.

Feel free to post a fixed jsbin in reply.

Even more naive nested routing…

If you navigate to route posts, Ember.js looks for a controller called App.PostsController. If you did not define it, one will be generated for you.

Ember.js can generate three types of controllers: Ember.ObjectController, Ember.ArrayController, and Ember.Controller.

But this naive example seems to contradict that.

When I navigate into the specific post.index route

Assertion failed: The value that #each loops over must be an Array. You passed <(generated post.index controller):ember370> ember-latest.js:364

Uncaught TypeError: Object [object Object] has no method ‘addArrayObserver’

Model in posts.index loads but not in post.index

not sure why…

In these examples I am trying to make a functional example with the minimal code required. Let Ember JS generated controllers do their thing. Feel free to post fixed JSBin in reply.

I’m not expert on EmberJS, but here’s my take (based on your example) on this topic. Hope I’m doing it right.


Very nice! Thanks for this example. Making it much more clear.


Was what I was looking for. I guess I assumed too much with the generated controllers and assumed that the models were automatically loaded by convention.

That’s great! I haven’t seen modelFor used anywhere yet, and this kind of clears up some ambiguity I was having about nested routes… I would love to see like a tutorial based on nested routes and conventions that can be utilized.

Another related github issue around nested routes. Adding here for posterity

Related to this example of attempting a deeply nested structure in ember JS trying to emulate taxonomic rank in the UI.

A JSBin example I created to demonstrate nesting and non nesting