あなたがあなたの見解でモデルを見ていない最も可能性が高い理由は、レンダリングが非同期の前に起こっているからです fetch
完全です。
以下のようなものはうまくいくでしょう:
mdm.LinksView = Backbone.View.extend({
el: '#link_list',
initialize: function() {
this.collection = new mdm.Posts();
this.listenTo(this.collection, 'reset', this.render);
this.collection.fetch({reset: true});
}
上記のコードは、のリスナーを設定します reset
のイベント collection
と実行します render
それが起こったときに機能します。
また、渡すこともできます success
と error
ハンドラーに fetch
レンダリング関数も手動で呼び出します。
this.collection.fetch({
success: _.bind(function() {
this.render(); }, this)
});
お役に立てれば!