Reputation: 300
I'm having problems passing template variables into helpers, i got a template like that
{{#each row in workpage.mainStructure}}
<div class='row'>
<div class='cell cell-2'>{{i18nForecasts row.value }}</div>
{{#each cell in row.amounts}}
<div class='cell'>{{cell.format}}</div>
{{/each}}
</div>
{{/each}}
and my helpers only needs to log the passing val:
Ember.Handlebars.registerHelper('i18nForecasts', function(property, options) {
var escaped = Handlebars.Utils.escapeExpression(property);
console.log(escaped);
});
The thing is that i only get the value as 'row' in string and not the looping values. but if i try to print the value with out the helper like:
{{row.value}}
It prints the correct loop value.
Upvotes: 1
Views: 316
Reputation: 47367
You'll want to use registerBoundHelper
, http://emberjs.com/api/classes/Ember.Handlebars.html#method_registerBoundHelper
Ember.Handlebars.registerBoundHelper('i18nForecasts', function(property, options) {
var escaped = Handlebars.Utils.escapeExpression(property);
console.log(escaped);
});
Upvotes: 2