I'm trying to write a custom Ember handlebars helper that will return some HTML, but I can't access the block contents within the helper.
Template:
{{#link}}
This is the block content
{{/link}}
Helper:
Ember.Handlebars.registerHelper('link', function (options) {
var result = '<a href="http://example.com/">'
+ options.fn(this)
+ '</a>';
return new Handlebars.SafeString(result);
});
The result I'm expecting is: <a href="http://example.com/">This is the block content</a>
Instead I get: This is the block content <a href="http://example.com/">undefined</a>
Fiddle: http://jsfiddle.net/NQKvy/676/
What am I doing wrong?