I want to iterate over an array in handlebar, and with the index of each element print one element in other json or array that i have defined.
something like this:
{{#each groups as |group index|}}
{{#sticky-element top=41}}
{{ad-component data=adGroup.[index].ad2 class="average-ad"}}
{{/sticky-element}}
{{/each}}
My component its something like this:
import Ember from 'ember';
export default Ember.Component.extend({
adGroup: {
'0': {"ad1": "div-gpt-ad-123-0", "ad2": "div-gpt-ad-123-4"},
'1': {"ad1": "div-gpt-ad-123-1", "ad2": "div-gpt-ad-123-5"},
'2': {"ad1": "div-gpt-ad-123-2", "ad2": "div-gpt-ad-123-3"}
}
});
but pitifully it is not possible do this in handlebar.
Some people recommend me use computed properties, but how can I create a computed property for this mission?
I don't know if these last 2 days are not my lucky days or what's going on, because i think this is something simple, but I cannot with this, some help please?
groups, why do you loop through it? do you even needgroup? Because, for this you can loop throughadGroupdirectly witheach-in.