I have a modelA, modelB, and modelC. modelA hasMany modelB, modelB belongsTo modelA, modelB belongsTo modelC.
Below is my computed property on my component.js and the code below is I want to get all the modelA where the modelC id is equal to the baz.id
foo: computed('modelA', 'baz.id', function() {
return this.get('modelA').filter((a) => {
return a.get('modelB').filter((b) => {
let userId = b.get('modelC.id');
let bazId = this.get('baz.id');
if (userId === bazId) {
return b;
}
})
});
}),
Issue: I am not getting the correct response. The response is not equivalent to my expectations. Question: Did I implement the computed property correctly based on my desired scenario which is I want to get all the modelA where the modelC id is equal to the baz.id
Appreciate for any response. Thank you
Aucun commentaire:
Enregistrer un commentaire