Reputation: 4033
This must be a real novice question but I've look at all the top answers on StackOverflow and I just don't see my answer. Sorry if it was already answered.
I'm simply doing a loop over multiple categories. For some reason the parameters of my helper isn't dynamic. It takes it as if it was a string.
{{#each catalog.catalog_categories}}
alert({{this.category_name_en_sh}} ); // Alert "Computer
{{&categoryHelper this.category_name_fr_sh}}
{{/each}}
In my app.js
Ember.Handlebars.registerHelper('categoryHelper', function(category) {
alert(category) // Alert category_name_fr_sh
...
});
What am I doing wrong?
Upvotes: 0
Views: 300
Reputation: 47367
just use helper, not registerHelper
Ember.Handlebars.helper('categoryHelper', function(category) {
alert(category);
});
registerHelper is the appropriate use if you are using stock handlebars, not the ember handlebars.
http://emberjs.com/guides/templates/writing-helpers/
Upvotes: 1