Problems retrieving data from controller using Ember.js 2.3.0 -
i trying learn ember following course , have following controller
import ember 'ember'; export default ember.controller.extend({ title:'my blog post', body:'body of post', authors:['author1', 'author2', 'author3'], comments:[ { name:'name 1', comment:'comment 1' }, { name:'name 2', comment:'comment 2' }, { name:'name 3', comment:'comment 3' } ] });
and template:
<h1>{{title}}</h1> <p>{{body}}</p> <p> <strong>authors:</strong> {{#each authors}} {{this}}, {{/each}} </p> <h4>comments</h4> <ul> {{#each comments c}} <li><strong>{{name}}</strong> - {{comment}}</li> {{/each}} </ul>
and has been generating output:
my blog post body of post authors: <my-app@controller:post::ember424>, <my-app@controller:post::ember424>, <my-app@controller:post::ember424>, comments - - -
i double check , identical demo seem, try use {{#each comments |c|}}, {{each authors author}} {{this.author}}, try use {{c.name}}, try {{this.name}}, {{this.c.name}}
any ideas going wrong?
thanks in advance
change template file this:
<h1>{{title}}</h1> <p>{{body}}</p> <p> <strong>authors:</strong> {{#each authors |author|}} {{author}}, {{/each}} </p> <h4>comments</h4> <ul> {{#each comments |c|}} <li><strong>{{c.name}}</strong> - {{c.comment}}</li> {{/each}} </ul>
Comments
Post a Comment