使用Ember.js 2.3.0从控制器检索数据时出现问题

使用Ember.js 2.3.0从控制器检索数据时出现问题,ember.js,Ember.js,我试图学习灰烬以下这门课程,我有以下控制器 import Ember from 'ember'; export default Ember.Controller.extend({ title:'My Blog Post', body:'Body of the post', authors:['Author1', 'Author2', 'Author3'], comments:[ { name:'name 1', comment:'comment

我试图学习灰烬以下这门课程,我有以下控制器

import Ember from 'ember';

export default Ember.Controller.extend({
  title:'My Blog Post',
  body:'Body of the post',
  authors:['Author1', 'Author2', 'Author3'],
  comments:[
    {
      name:'name 1',
      comment:'comment 1'
    },
    {
      name:'name 2',
      comment:'comment 2'
    },
    {
      name:'name 3',
      comment:'comment 3'
    }
  ]
});
和模板:

<h1>{{title}}</h1>
<p>{{body}}</p>
<p>
  <strong>Authors:</strong>
  {{#each authors}}
    {{this}},
  {{/each}}
</p>
<h4>Comments</h4>
<ul>
{{#each comments as c}}
  <li><strong>{{name}}</strong> - {{comment}}</li>
{{/each}}
</ul>
{{title}
{{body}}

作者: {{{#每位作者} {{this}}, {{/每个}}

评论
    {{{#每个评论都是c}
  • {{name}-{{comment}
  • {{/每个}}
它一直在产生这样的输出:

我的博客帖子
正文
作者:,
评论
-
-
-
我仔细检查了所有内容,它似乎与我的演示完全相同,我还尝试使用{{{{{{35;每个评论为{124; c}},{{{每个作者为作者}{{{this.author}},尝试使用{c.name},也尝试使用{{this.name},{{{this.c.name}}

你知道我哪里出错了吗


提前感谢

将模板文件更改为:

<h1>{{title}}</h1>
<p>{{body}}</p>
<p>
  <strong>Authors:</strong>
  {{#each authors as |author|}}
    {{author}},
  {{/each}}
</p>
<h4>Comments</h4>
<ul>
{{#each comments as |c|}}
  <li><strong>{{c.name}}</strong> - {{c.comment}}</li>
{{/each}}
</ul>
{{title}
{{body}}

作者: {{{#每个作者都是{作者} {{作者}}, {{/每个}}

评论
    {{{#每个评论都是{c}
  • {{c.name}-{c.comment}
  • {{/每个}}

将模板文件更改为:

<h1>{{title}}</h1>
<p>{{body}}</p>
<p>
  <strong>Authors:</strong>
  {{#each authors as |author|}}
    {{author}},
  {{/each}}
</p>
<h4>Comments</h4>
<ul>
{{#each comments as |c|}}
  <li><strong>{{c.name}}</strong> - {{c.comment}}</li>
{{/each}}
</ul>
{{title}
{{body}}

作者: {{{#每个作者都是{作者} {{作者}}, {{/每个}}

评论
    {{{#每个评论都是{c}
  • {{c.name}-{c.comment}
  • {{/每个}}

谢谢@Dan#C,我更新了{{{#每条评论为{C}},但是我没有使用{C.name}来完成这个任务trick@lcaro,很高兴有帮助!:)谢谢@danu#C,我更新了{{{#每条评论为{C|}},但我没有使用{C.name}进行更新trick@lcaro,很高兴有帮助!:)