在设置应用路由器,我请求一些数据到后端:触发功能,一旦一个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