I'm trying to have a helper output nutrient totals based on a list (array) of ingredients. Since I want to display the totals of one of many nutrients I need to somehow pass it a parameter that defines the nutrient in question. So I figured a helper would be the way to go, something like this:
The problem is that the helper is only rendered/run once. However, the helper is updated when a new item is pushed to the list so it seems to be possible. I think I am missing something here. Should helpers be run again if a parameter changes, or should I be trying something else?
The list looks like this:
{
ingredient: {
name: 'Potato',
group: 'Veggies',
nutrients: [{
name: 'kcal',
nutritionalValue: 87
}, {
name: 'kJ',
nutritionalValue: 42
}]
},
weight: 42
}
Here's the Twiddle
Thanks,
Martien
Aucun commentaire:
Enregistrer un commentaire