This will work:
App.Label = Ember.View.extend({
tagName: "span",
classNames: "label",
template: Ember.Handlebars.compile("{{view.content}}")
});
Ember.Handlebars.registerHelper('bslabel', function(content, options) {
options.hash.content = content;
return Ember.Handlebars.helpers.view.call(this, App.Label, options);
});
registerHelper
takes each argument given to the view helper and a final options
object. If you use Ember.Handlebars.helpers.view.call
like a lot of the internal views in Ember, options.hash
will be the properties given to that view. So in this case we take the content
given as the second argument to our {{bslabel}}
helper, and set it as the content
property of the view.
You need to put the content in quotes for this implementation to work:
{{bslabel "Label content goes here"}}