【发布时间】:2016-06-13 15:29:26
【问题描述】:
作为我的应用程序工作流程的一部分,我遇到了一个冲突情况:我的代码的一部分试图将特定的 Object 查找到尚未加载的 hasMany 关系中,因此它正在返回 @ 987654324@.
我正在使用Ember.Array.findBy method,希望它能处理所有承诺的特质。
这是失败的行:
this.get('report.charts').findBy('questionId', questionId);
//-> undefined
很明显,在我调用这一行时,report.charts 并未全部加载:
this.get('report.charts').map(function(e){ return e.get('questionId') });
//-> ["Wiese_030", undefined, undefined, undefined, undefined]
更多信息:
this.get('report.charts').toString();
//-> "<DS.PromiseManyArray:ember1209>"
这种情况有什么办法处理?
【问题讨论】: