How to use multiple parameters in a handlebar helper with meteor?

喜夏-厌秋 提交于 2019-12-02 18:42:49

Your logic is good, just make some changes to the template

<template name="myTemplate">
  {{testHelper "value1" "value2"}}
</template>

Bare in mind that the testHelper function is only defined in the myTemplate template.

If you want to register testHelper globally you'll need to do something like this

Handlebars.registerHelper('testHelper', function(foo, bar){
  console.log(foo);
  console.log(bar);
});

Have fun

Addition to

<template name="myTemplate"> {{testHelper "value1" "value2"}} </template>

Instead of passing a value as a parameter pass the function as parameter Here is the code for that

<template name="myTemplate">
    {{ testHelper1 (testHelper2 "value2") }}
</template>

cheers!!!!!

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!