0

I have already tried this SO Post

But, i want to achieve the following:

Component

abc = [10,20,30,40,50]
cde = [0,1,2,3,4]

Template

{{#each cde as |num|}}
  {{ abc.[num] }}
{{/each}}

Expected Output:

10 20 30 40 50

But, it doesn't output anything. What is wrong?

Ganesh K
  • 3
  • 4

1 Answers1

2

Try this,

{{#each cde as |num|}}
  {{get abc (concat num '')}}
{{/each}}

I dont get the need for cde array, each block comes with index, if needed you can use it.

{{#each abc as |num index|}}
Ember Freak
  • 12,918
  • 4
  • 24
  • 54