dimanche 16 septembre 2018

How to find an object by ID in an ember template

I have a data structure like this:

let colors = {colorArray: [{id: 1, color: "blue"}, {id: 2, color: "red"}], anotherVariable: "anotherValue"}

I have an each helper like this:


    <div>...</div>


I want to return the object in colors.colorArray that corresponds to the ID of the post I'm iterating over. I'm unsure how to go about this. I tried using an ember-composable-helper, but nothing logs (no errors, either). Here is what I tried:


   
      
   


What am I do wrong? Is there another way I could go about this?




Aucun commentaire:

Enregistrer un commentaire