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?

1 Answer 1

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|}}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.