There are quite a few posts out there about this topic. I wrote one myself a while back.
There is also another topic on this forum that goes over this topic as well. The solution in that thread was to do the following:
import Ember from 'ember';
function renderComponent(componentPath, options) {
var helper = Ember.Handlebars.resolveHelper(options.data.view.container, componentPath);
return helper.call(this, options);
}
export {
renderComponent
};
export default Ember.Handlebars.makeBoundHelper(renderComponent);
The issue with this is that options.data.view.container
is no longer available as of Ember 1.9 (possibly 1.8, I havenât checked that though). As a temporary stop-gap, you can avoid creating a helper via makeBoundHelper
and do something like this:
export default function(componentBinding, options) {
var componentPath = Ember.Handlebars.get(this, componentBinding, options),
helper = Ember.Handlebars.resolveHelper(options.data.view.container, componentPath);
return helper.call(this, options);
});
Here weâre simply accounting for the fact that our first argument is no longer a bound value, but the binding path. To get the actual value, we must call Ember.Handlebars.get
(makeBoundHelper
takes care of this for us, hence the name bound
.). However, Ember.Handlebars.get
is deprecated in favor of makeBoundHelper
, so this is not an ideal solution.
The ideal solution, in my opinion, is to figure out where options.data.view.container
went when using makeBoundHelper
. Does anyone have any insight into this issue?