Dynamically adding to a contextual component hash


#1

I’m feeling enamored with the new contextual components, and there’s something I’d like to try to do, but I’m not sure it’s possible. Basically, you can hard-code in a contextual component like this:

  {{yield (hash
    close-button=(component 'alert-box-button' onclick=(action 'close'))
  )}}

But what if I wanted to yield additional components by iterating over an array? Something like:

  {{yield (hash
    {{#each componentNames as |componentName|}}
      componentName=(component componentName onclick=(action 'close'))
    {{/each}}
  )}}

Pie in the sky impossible, right? But maybe there’s a way to pull this off? If there is, please let me know!


#2

I found this thread, blew away the cobwebs, dusted it off, and repeat the question:

Is it possible to yield a hash filled with curried component invocations that are dynamically determined by configuration or not?

Documentation seems to suggest it’s not possible, as there is no way to set members in a hash after its declaration, and as it has been stated that the only proper way to instantiate a component is within the template.

HOWEVER, I really want it. How do I do it?