javascript - 在 Ember 中以编程方式调用 Handlebars 助手

标签 javascript ember.js handlebars.js

我的一个组件需要根据提供的参数动态选择一个 Handlebar 助手。

类似的东西{{dynamic-output value=value helper=helper}}

在组件类中,我想根据提供的帮助器输出值。

我找不到太多有关以编程方式使用 Handlebars 助手的信息:(

最佳答案

基本上,如果您有一个名为 selectBoxOptions 的帮助程序,则可以在帮助程序中使用以下代码来调用该帮助程序:

返回 Handlebars.helpers.selectBoxOptions(selectedValue, options);

请参阅此博文了解更多详细信息:http://www.remwebdevelopment.com/blog/javascript/handlebars-calling-a-helper-function-from-another-helper-231.html

关于javascript - 在 Ember 中以编程方式调用 Handlebars 助手,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21768501/

相关文章:

javascript - vuejs : how to unit test main. ts

javascript - 无法让我的文本值在我的查询中工作

ember.js - Ember 路由器 : Asynchronous model (promises? )

javascript - 在 Handlebars 中显示特定行数据而不使用每个子句

javascript - 基于模型类型的 ember 组件

javascript - 如何使用 YouTube api v3 禁止在播放列表中插入相同视频

javascript - 为什么 jQuery 中的 click() 方法与 DOM click method() 的行为不同?

javascript - Handlebarsjs 对象数组 : TypeError: Cannot read property 'id' of undefined

ember.js - Ember.js 中除 id 之外的动态段

ember.js - 如何将任意模板变量传递到 Handlebars 助手中?