我的把手模板:
{{#each .}}
{{this}}
{{title}}<br>
{{author}}
{{/each}}
部分数据示例:
[
{
title:"How We Solve Big Problems By Thinking Small",
link:"http://product.hubspot.com/blog/how-our-product-team-thinks-small-to-solve-big-problems",
published:"2015-03-05T13:30:00.000Z",
author:"jboulter@hubspot.com (Jeff Boulter)",
site:"http://product.hubspot.com/blog"
},
{
title:"4 steps to better goals and metrics",
link:"http://engineering.pinterest.com/post/112720487359",
published:"2015-03-04T20:56:27.000Z",
author:"",
site:"http://engineering.pinterest.com/"
},
{
title:"33 Browser Stats You Just Might Believe",
link:"http://code.flickr.net/2015/03/04/browsers-in-2014/",
published:"2015-03-04T17:47:15.000Z",
author:"Phil Dokas",
site:"http://code.flickr.net"
}
]
似乎{{this}}打印出整个blob,这就是我可以正确显示它。
请参阅github上的项目,了解完整背景,this commit:)
非常感谢任何帮助。
答案 0 :(得分:3)
看起来您的有效负载是字符串而不是解析的JSON数组。
尝试
payload = JSON.parse(payload);
然后在你的车把模板中使用
{{#each payload}}
{{title}}<br>
{{author}}
{{/each}}