ember.js - Why does data from a model not render in an Ember template's {{#each}} loop? -
data seems loaded model not seem used when rendering page template in ember 2.1.0. how can data shown me in ember inspector called page template?
i have model:
app.part = ds.model.extend({ name: ds.attr('string'), summary: ds.attr('string') }); app.indexroute = ember.route.extend({ model: function() } return this.store.findall('part') } });
and template:
{{appname}} v {{appversion}} <ul> {{#each part in model}} <li>{{part.name}}</li> {{else}} none found... {{/each}} </ul>
and in ember inspector see data (loaded via restadapter):
but template when rendered says, "none found..." , never lists data appears have been loaded. have tried multiple variations of {{#each}} tag.
a standard app controller loads data template fine (calling {{appname}} or {{appversion}}):
app.applicationcontroller = ember.controller.extend({ appname: "my app", appversion: "1.0", });
ember 2.1.0, emberdata 2.1.0, emberinspector 1.9.3
the application
template won't show model index
route.
change app.indexroute
app.applicationroute
.
alternatively, can split template up:
application.hbs
{{appname}} v {{appversion}} {{outlet}}
index.hbs
<ul> {{#each part in model}} <li>{{part.name}}</li> {{else}} none found... {{/each}} </ul>
Comments
Post a Comment