Ember.js在模型钩子中多次调用api

时间:2016-03-14 07:57:45

标签: ember.js

我想从下面的API中填写多个下拉列表,我必须传递类型参数,例如' department',' priority'它没有返回部门和优先级的预期结果返回数据。



//....route.js
model(){
  var _this=this;
  return Ember.RSVP.hash({
            status: _this.fetchLookup('department'),
            priority: _this.fetchLookup('priority'),
  });
},
fetchLookup(type) {
  return this.store.query('lookup', {
                    LookupType: type
                });
}




1 个答案:

答案 0 :(得分:0)

你可能做错了什么。

我刚刚在jsbin中尝试过,它运行正常:http://emberjs.jsbin.com/sihacu/1/edit?html,js,output

您甚至可以在控制台中看到两个不同的请求。