在设置应用程序路由器时,我正在向后端请求一些数据:
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();
});
}