0
function getFruitsData()
{
var fruit=[];
fruit.push("Apple");
fruit.push("Mango");
fruit.push("Grapes");
fruit.push("Orange");

return fruit;
}

the fruits data i am sending to template which is coming in console

enter image description here

Now i need to show like this Fruits[0] which will result >>> Apple

right Now in template i using this which is not working

{{#each someOtherList}}

{{this.[Fruits].@index.this}} >> not working
{{Fruits.@index.this}} >> not working
{{Fruits.[@index]}} >> not working

{{/each}}

i don't need to iterate all data i just need specific data according to index i pass

bhaskarkh
  • 179
  • 2
  • 11
  • Use the built-in `lookup` helper. https://handlebarsjs.com/guide/builtin-helpers.html#lookup I have answered a few questions that are very similar. See: https://stackoverflow.com/a/54274111/3397771 or https://stackoverflow.com/a/61775752/3397771 – 76484 Jun 09 '20 at 14:21
  • Did not get how to use i am new in handlebar can you help me with reference to above example – bhaskarkh Jun 09 '20 at 15:20
  • Got the answer {{lookup ../Fruits @index}} – bhaskarkh Jun 09 '20 at 15:22
  • Thank you for the hint – bhaskarkh Jun 09 '20 at 15:23

0 Answers0