We are working on a ember-bootstrap demo project at
All we want to be able to do is to have a helper call a view with the content.
{{ bslabel label}}
Bootstrap.Label = Ember.View.extend
tagName: "span"
classNames: "label"
template: Ember.Handlebars.compile("{{view.content}}")
Something as simple as the above. How do we get them to play nice together!?
We have looked at:
Which was last edited 3 days ago.
We have been trying all kinds of different approaches, but no matter what, we get the error:
Uncaught You canât use appendChild outside of the rendering process.
Looks really simple
Ember.Handlebars.registerHelper('errorField', function(property, options) {
if (this.get('errors')) {
options.hash.property = property;
return Ember.Handlebars.helpers.view.call(this, Ember.EasyForm.Error, options);
}
});
This is how you it could be done 2 months ago?
Ember.Handlebars.registerBoundHelper('formFor', function(object, options) {
return Ember.Handlebars.helpers.view.call(object, Ember.EasyForm.Form, options);
});
Passing the incoming object as the first argument to view !? Does this still work?
Where is there any updated documentation on how to create helpers that call views!?
We have been using this one, but looks outdated? Banking and Funding for eCommerce & Amazon Sellers | Viably
Here is a sample of our attempts:
Bootstrap.Label = Ember.View.extend Bootstrap.TypeSupport,
tagName: "span"
classNames: "label"
baseClassName: "label"
template: Ember.Handlebars.compile("{{view.content}}")
Bootstrap.Label.helper = (view, options) ->
childView = Bootstrap.Label
currentView = options.data.view
currentView.appendChild childView, options.hash
Ember.Handlebars.registerBoundHelper 'bslabel', (options) ->
viewContext = options.data.view
Bootstrap.Label.helper(this, options)
# Ember.Handlebars.helpers.view.apply(viewContext, [Bootstrap.Label, options])
Ember.Handlebars.registerBoundHelper 'ourbslabel', (object, options) ->
# Ember.Handlebars.helpers.view.call(object, Bootstrap.Label, options)
Ember.Handlebars.helpers.view.call(this, Bootstrap.Label, options)
Note that the view says template: Ember.Handlebars.compile("{{view.content}}")
Maybe this is the problem!?
Calling from a template (using latest Chrome)
{{bslabel content="Default"}}
{{bslabel contentBinding="controller.label" typeBinding="controller.type"}}
Note: Our problem is only the dynamic case, specifically the contentBinding for the label text.
App.LabelsController = Ember.ObjectController.extend
label: 'Success'
type: 'success'
types: ['success', 'warning', 'important', 'info', 'inverse']
select: (type) ->
@set 'type', type
@set 'label', type.camelize()
We also tried this approach, setting contentBinding of the options hash explicitly before calling view:
Ember.Handlebars.registerBoundHelper 'bslabel', (property, options) ->
console.log arguments
options.hash.contentBinding = property
# or even setting content!?
# options.hash.content = property
Ember.Handlebars.helpers.view.call(this, Bootstrap.Label, options)
{{ bslabel "Default"}}
{{ bslabel label typeBinding="type"}}
Uncaught You canât use appendChild outside of the rendering process
What can we do to make content
or contentBinding
work inside the view when calling it from a helper!?
Any advice would be helpful. Thanks!