我正在尝试在我的车把模板中打印日期属性。但是输出是空的。我该如何渲染它?
我的模型:
App.Post = DS.Model.extend({
type: DS.attr('string'),
title: DS.attr('string'),
summary: DS.attr('string'),
body: DS.attr('string'),
date: DS.attr('date')
});
App.Post.FIXTURES = [
{id:1, type:"news", title:"Some", summary:"Lorem ", date:new Date()},
{id:2, type:"gallery", title:"Some", summary:"Lorem", date:new Date()}
];
我的车把模板:
<script type="text/x-handlebars" data-template-name="posts">
{{#each post in controller}}
{{post.date}}: {{post.type}}- {{post.title}}
{{/each}}
</script>