我需要設置控制器的多種型號的機型applicationRoute
鉤時:Ember.js回報承諾在ApplicationRoute設置多個控制器型號
model: function() {
this.controllerFor('markets').set('model', this.store.pushPayload('market', marketsCache));
this.controllerFor('pages').set('model', this.store.pushPayload('page', pagesCache));
this.controllerFor('categories').set('model', this.store.pushPayload('category', categoriesCache));
this.controllerFor('employees').set('model', this.store.pushPayload('employee', employeesCache));
}
在我的網絡服務器index.php文件中我設置的JavaScript變量marketsCache
, pagesCache
,categoriesCache
和employeesCache
。它們從APC緩存中檢索,因爲API是查詢密集型的。如您所見,我希望應用程序等待模型滿員。但是,就我所知,承諾僅適用於AJAX請求。所以,問題是,是否有可能將這些controllerFor
行列入承諾?
感謝您的評論!但是,當我做一個:'this.store.find' REST適配器被調用我想?那真的不是我想要的。因爲該API將獲得該模型的另一個調用。 – DelphiLynx
對不起,我只是想過,我意識到你可能不想這樣做,你可以忽略散列和setupController,只是使用'全部' – Kingpin2k
更新反映使用所有 – Kingpin2k