1
votes

I have read various stackoverflow threads and other forum entries, but I am not able to figure out how to get nested resources/templates working using ember-cli 0.1.12 and pod structure.

Versions:

  • Ember : 1.8.1 (also tried 1.9.1)
  • Ember Data : 1.0.0-beta.12
  • Handlebars : 1.3.0 (also tried 2.0.0)
  • jQuery : 1.11.2

My router.js (unchanged, cli created it, only demo purposes):

Router.map(function() {
    this.resource("controls", function() {
    this.route("statements");
    this.resource("handles", function() {});
});

Situation:

  • No additional modifications besides ember generate commands and text markers in the created template.hbs
  • Resource "controls": template is displayed as expected
  • Route "controls/statements": template is displayed as expected
  • Resource "handles" under resource "controls" is not rendered at at all.
  • Subsequent routes unter "controls/handles" are also not working.
  • When I invoke http://localhost:4200/controls/handles, ember inspector only list "application" and "controls" in the view tree. In the ember inspector routes section, it lists: handles.index HandlesIndexRoute Send to console HandlesIndexController Send to console handles/index /controls/handles

I tried:

  • Switching ember and handlebar versions - no effect
  • Not using pod structure - no effect
  • Manually adding an index.hbs template in the handles pod folder - no effect

I have the feeling that I am missing a basic point here. Could you please help me out?

Thank you, Manuel

1

1 Answers

0
votes

I can't help on the pod issue but can try on the other point. What is the nature of your nested resource?

I would be expecting URLs like: "..controls/:control_id/handles".

I would have written this like this:

this.resource('controls', function() {
  this.route('statements');
  this.route('show', { path: ':control_id' }, function() {
    this.resource('handles', function() {
    });
  });
});

Nick