获取后检索集合的内容

时间:2013-02-26 14:02:31

标签: backbone.js fetch

我正在尝试从集合中的本地存储中检索我的模型。我进入“成功”但有时我的收藏仍然是空的。我认为“成功”意味着收藏很好。

    var self = this;
    window.rooms= new Rooms();
    window.rooms.localStorage = new Backbone.LocalStorage("rooms-backbone");
    window.rooms.fetch({
        success: function(model, response, options) {
            rooms.each(function(room){
                this.template = _.template(tpl.get('RoomView'));
                $(self.el).append(this.template(room.toJSON()));
                console.log(rooms.toJSON());

                console.log(model);
                console.log(response);
                console.log(options);
            });
        }
    });

如果我确定收藏品已经填满,我如何填充我的用户界面? Thx提前

0 个答案:

没有答案