Я пытаюсь понять, как работает часть backbone.js. Мне нужно собрать коллекцию моделей после начала приложения. Мне нужно подождать, пока выборка не будет завершена, чтобы отобразить каждое представление. Я не уверен на 100% наилучшего подхода к этому экземпляру.
var AppRouter = Backbone.Router.extend({
    routes: {
        "": "home",
        "customer/:id": "customer" 
    },
    home: function () {
        console.log("Home");
    },
    customer: function (id) {
        if (this.custromers == null)
            this.init();
        var customer = this.customers.at(2); //This is undefined until fetch is complete. Log always says undefined.
        console.log(customer);
    },
    init: function () {
        console.log("init");
        this.customers = new CustomerCollection();
        this.customers.fetch({
            success: function () {
                console.log("success"); 
                // I need to be able to render view on success.
            }
        });
        console.log(this.customers);
    }
});