在設置應用路由器,我請求一些數據到後端:觸發功能,一旦一個REST請求已完成
App.Node = DS.Model.extend({
...
});
App.ApplicationRoute = Ember.Route.extend({
processReply: function () { do some processing here; },
setupController: function (controller, model) {
this.cache = App.Node.find();
}
});
現在,當從後臺收到的find
的結果,我想通過調用this.processReply()
我怎樣才能聽到find
請求的完成?我試圖插入.then
方法(假設find
返回承諾),但是這阻止了我的應用程序。
setupController: function (controller, model) {
var _this = this;
this.cache = App.Node.find().then(function(data) {
_this.process();
});
}
你在哪裏,刪除了我的答案,因爲它不適用於你的用例 – intuitivepixel