Hello!
I’ve started writing my first Ember project. I am using Ember.js 1.9.1 and Handlebars 2.0.0, but I’ve already ran into suprising behaviour when nesting custom helpers.
According to handlebars doc syntax for nesting is following:
{{orange (apple "test")}}
When I define my helpers as such:
Ember.Handlebars.helper('apple', function(value) {
return 'apple(' + value + ')';
});
Ember.Handlebars.helper('orange', function(value) {
return 'orange(' + value + ')';
});
It’s rendered like this:
apple(test)orange(undefined)
When I register them as such:
Ember.Handlebars.registerBoundHelper('apple', function(value) {
return 'apple(' + value + ')';
});
Ember.Handlebars.registerBoundHelper('orange', function(value) {
return 'orange(' + value + ')';
});
Also produces invalid output:
apple(test)orange(undefined)
Finally when I register them using registerHelper they suddenly start working:
Ember.Handlebars.registerHelper('apple', function(value) {
return 'apple(' + value + ')';
});
Ember.Handlebars.registerHelper('orange', function(value) {
return 'orange(' + value + ')';
});
Renders:
orange(apple(test))
I would be very grateful for explanation what I am doing wrong.