-1
我想过滤来自的FindAll回来的数据,因为我只想从某一个供应商灰烬数据FilterBy
// Data coming back from API
{
"-KDinaItb7lkHpai-DlG": {
"email": "[email protected]",
"name": "John Smith",
"notes": "John is a great employee and is the best",
"phone": "215-543-9830",
"provider": "-KDhzbilOvv7Evuc5S_X"
},
"-KDjS0cCxFWQctcwXg0V": {
"email": "[email protected]",
"name": "Amanda Harrington",
"notes": "Amanda is a great employee",
"phone": "215-543-9830",
"provider": "-KDiokWebdhTNKTORWwn"
},
"-KDyf7pU_PyxRQSgFB59": {
"email": "[email protected]",
"name": "Larry Guy",
"notes": "He is a funny guy",
"phone": "702-454-2397",
"provider": "-KDhzbilOvv7Evuc5S_X"
}
}
// In the route
let providerId = model.get('provider').get('id');
this.store.findAll('employee').then(function(results) {
let prov = results.filterBy('provider', providerId);
console.log(prov);
});
数据当控制台日志发生,它返回一个空数组。我认为它是因为ID而没有看着嵌套的对象。任何人有任何想法?
'filterBy'工作在阵列不是对象。询问服务器端的人把它作为阵列发送。 – murli2308