我有一个呈现Comment. 其中一条信息是评论更新的时间,我想使用视图来呈现它。
在我的“评论”车把模板中,我正在尝试这个:
{{view App.TimeView titleBinding="comment.updated_time"}}
然后在我的“时间”车把模板中,我希望能够做到{{title}},但这是未定义的。
我的TimeView样子是这样的:
App.TimeView = Em.View.extend({                                                                       
    templateName: 'time',                                                                                
    tagName: 'abbr',
    classNames: ['timeago'],                                                                                
    attributeBinding: ['title'],                                                                            
    didInsertElement: function() {
        this._super();                                                                                      
        this.$().timeago();                                                                                 
    }
});
我想要的最终结果是这样的:
<abbr class="timeago" title="TIMESTAMP_GOES_HERE">
    TIMESTAMP_GOES_HERE
</abbr>
但是我对 Ember 的理解肯定有一些差距,因为那没有发生。
实现我的想法的正确方法是什么?