Quantcast
Channel: JavaScriptMVC Forum
Viewing all articles
Browse latest Browse all 3491

Re : can.view doesn't render deferred data

$
0
0
This should all now be using Components.

I also used embedded reference templates heavily prior to Component and had lots of rendering issues. This completely disappears with Components.

Your basically using EditForm as a supervising controller that would now render a different Component based on the deferred's results right?

Something more like this would be what you're after:

  1. Assignments.findOne({id: options.id})
  2. .done(function(data){
  3. self.element.append(can.view.mustache("<ul>{{#each}}<li><app-engineer></app-engineer></li>{{#each}}</ul>")(data.engineers));
  4. })
  5. .fail(function(xhr){
  6. self.element.append(can.view.mustache("<div class='error'>Assignment not found.</div>"));
  7. })

You could also just do all this in the editform.mustache like this:

  1. <div class="assignment">
  2. {{#if customers}}
  3. <ul>
  4. {{#customers}}<li><app-customer></app-customer></li>{{#customers}}
  5. </ul>
  6. {{/if}}
  7. {{#if engineers}}
  8. <ul>
  9. {{#engineers}}<li><app-engineer></app-engineer></li>{{#engineers}}
  10. </ul>
  11. {{/if}}
  12. </div>
I would make EditForm a Component too under this scenario.

Viewing all articles
Browse latest Browse all 3491

Trending Articles