0

I'm trying to achieve a very single application, but I'm having a (probably stupid) issue.

I have a homepage with a link to albums which renders a collection of albums.

A click on an album should display the album.

Everything works fine except that when I click on an album nothing happens.

I would expect it to be displayed ....

You can try the live example here: No longer valid.

And the source code is there: No longer valid.

Thanks, it's probably stupid but I can't find why it doesn't work !!!!

1 Answer 1

2

I guess, there is missing an outlet. Your AlbumResource is nested in the AlbumsRoute. Therefore the template for the AlbumsRoute should contain an {{outlet}}. Outlets are the place where Ember injects Views. Per default Embers tries to find an outlet in the currently active template (albums in your case) and will try to inject the ChildView there (in your case an AlbumView).

<h1>Posts</h1>
<ul>
{{#each album in controller}}
  <li>{{#linkTo 'album' album}}{{album.name}}{{/linkTo}}</li>
{{else}}
  <li>There are no albums.</li>
{{/each}}
</ul>
{{outlet}}

Remark: Note that it is nearly useless to link such a complex setup in a SO question. It is difficult to read and it's just luck that i have found it (if i have). Better set up a fiddle or at least link a live example with unminified sources.

Sign up to request clarification or add additional context in comments.

3 Comments

Your answer helps a lot ! It now "works", but I don't want to see the list of albums when I click an album. Indeed, the album is displayed just in the bottom of the albums. Any idea ?
Citing Yehuda Katz: "If your UI is nested, your Routes/Resources should be nested." If your UI is not nested, don't nest your Routes. Pull the resource on top level instead of nesting it ;-)
I told you this was a stupid question :) Everything now works as expected. Thanks a lot :-)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.