[英]ember.js handlebar - using variables inside action helper
I am trying to create dynamic menu for a cms. 我正在尝试为cms创建动态菜单。 I have action and target variables stored in database and I want to pass those to action helper: 我将动作和目标变量存储在数据库中,我想将它们传递给动作助手:
<li><a href="#" {{action this.action target=this.controllername}}>{{unbound this.name}}</a></li>
I wrote the above code and I am getting the following error on console: 我写了上面的代码,并在控制台上收到以下错误:
target[actionName] is undefined target [actionName]未定义
return target[actionName].call(target, event); 返回target [actionName] .call(target,event);
Kindly let me know what is the right way to do this. 请让我知道执行此操作的正确方法。
Regards, Karthik 此致Karthik
I think in this jsfiddle you find the answer to your question: 我认为在这个jsfiddle中,您找到了问题的答案:
http://jsfiddle.net/Malkyne/ydTWZ/ http://jsfiddle.net/Malkyne/ydTWZ/
{{#each item in content}}
<li>
<a {{action select item}} {{bindAttr class = "item.classNames"}}>
{{item.label}}
</a>
</li>
{{/each}}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.