How to render component / helper by name from instance field?
Is there a way to use component from controller / view field
So instead of using
{{contact-select label="Label:" contacts=form.prop}}
// or
{{input-field label="Label:" contacts=form.prop}}
// or
{{datepicker-component label="Label:" contacts=form.prop}}
use some like
{{context.helperName label="Label:" contacts=form.prop}}
I am trying to use the ember-helpers-render-component component but it does not accept the component name from the property
source to share
You can use the helper component that was introduced in 1.11.0. Unfortunately, there was no built-in way to do this prior to 1.11.0. If you can't update, this thread can point you in the direction of writing your own helper.
source to share
Version 1.11 has a helper component
for earlier versions I found relative questions / answers: How to dynamically load ember components by name in template? how can I dynamically call a dynamic component using a variable?
For my purposes, I adapt the code like this
https://github.com/vvs-code/ember-render-helper
and now I can use in my template
{{renderComponent field.type _param=field.value label=field.label}}
to get the same as
{{input field.value label=field.label}}
PS> as variat - it is possible to get the code from https://github.com/emberjs/ember.js/pull/10093 and put it directly into the project
source to share