Apparently this does not work: http://jsbin.com/efapob/3/edit
Ember.Handlebars.registerHelper('foo', function(options) {
var result = 'BEFORE '
+ options.fn(this)
+ ' AFTER';
return new Handlebars.SafeString(result);
});
And I assume it's because the fn() writes directly to the output buffer.
However, I need a way to directly work with the output of the block's content.
I tried overwriting a view's render
function, but that also didn't lead me anywhere.
(Background: I'm trying to write an {{#ifchanged}}
helper block that only renders if the contents have changed in comparison to the last call. The use case is a loop that should display something every time one property of the model is different to the last one. If you have other ideas how to achieve this, comments very appreciated!)