Run time argument to #each helper in handlebars
-
Is it possible to feed a function to the #each helper. I want to do something like this:
{{#each item}} <li>item.name</li> {{/each}} **************** function item(){ let x = [] x.push({name: "joe"}) x.push({name:"david"}) return x }
thanks
-
hi @duncanelliot yes, it is possible, you have to use a handlebars sub-expression for that.
{{#each (item)}}
-
Legend!