1

Im using Brunch and I added a custom helper. This works great in normal view templates but in compositeView's itemView template the variable passed to helper is undefined. Without a helper the template is compiled fine.

// Helper
Handlebars.registerHelper 'mny', (val) ->
    val.toString().replace( /\B(?=(\d{3})+(?!\d))/g, " " )

// Example
{{price}} //it works
{{mny price}} //it doesn't
4

1 回答 1

0

Handlebars 需要知道它的功能,所以#在 mny 前面加上 a

{{#mny price}}

希望能为你解决它

于 2015-01-14T23:07:54.617 回答