下面是一个典型的手把助手之间的区别:如何将参数传递给Handlebars helper?什么是options.hash&options.data
Ember.Handlebars.helper 'myHelper', (value, options) ->
...
根据this protip你可以通过散列手把帮手。我查看了源代码,发现它提供了options.hash
和options.data
。我预期有点糊涂,因为这是行不通的:
{{#with controllers.currentCardCategory}}
{{#each property in cardProperties}}
<td class="td">{{cardProperty this property=property.symbol}}</td>
{{/each}}
{{/with}}
this
是当前Card
记录。在这里,我得到了property.symbol
作为字符串
但是这工作:
{{#with controllers.currentCardCategory}}
{{#each property in cardProperties}}
<td class="td">{{cardProperty this property.symbol}}</td>
{{/each}}
{{/with}}
和值通过options
是访问。
但现在我不能做到这一点:
{{#with controllers.currentCardCategory}}
{{#each property in cardProperties}}
<td class="td">{{cardProperty this property.symbol anotherParam yetAnotherParam}}</td>
{{/each}}
{{/with}}
我的问题是:如何将其他参数传递给助手和什么在助手options.hash
和options.data
之间的区别?