将一个助手的结果传递给另一个助手?
Pass the result of a helper to another helper?
有什么方法可以在 handlebars 的 helper 中调用 helper 吗?我想做这样的事情:
{{#each myCustomHelper}}
<li>{{this}}</li>
{{/each}}
其中调用 myCustomHelper returns 一个字符串数组。
我正在尝试使用 express-handlebars 从节点执行此操作,我不想在每个 res.render 上传递该字符串数组。
我想避免也从 myCustomHelper 输出 html。
以上可能吗?
谢谢!
并找到了答案。至少在我的例子中,语法是:
{{#each (myCustomHelper)}}
<li>{{this}}</li>
{{/each}}
必须深入研究这个 issue 才能找到正确的语法
有什么方法可以在 handlebars 的 helper 中调用 helper 吗?我想做这样的事情:
{{#each myCustomHelper}}
<li>{{this}}</li>
{{/each}}
其中调用 myCustomHelper returns 一个字符串数组。
我正在尝试使用 express-handlebars 从节点执行此操作,我不想在每个 res.render 上传递该字符串数组。 我想避免也从 myCustomHelper 输出 html。 以上可能吗?
谢谢!
并找到了答案。至少在我的例子中,语法是:
{{#each (myCustomHelper)}}
<li>{{this}}</li>
{{/each}}
必须深入研究这个 issue 才能找到正确的语法