0

Was wondering if there's anything like ruby's .send for htmlbars. Been trying to search for it, but can't seem to find a proper answer. Here's what I want to do:

{{"name-of-helper" arguments}}

As simple as this. Is there any trick under it to achieve this effect?

Nelspike
  • 123
  • 2
  • 6
  • What does ruby's `send` do? –  Aug 31 '15 at 12:48
  • Check my updated question. Basically, you can call functions/methods dynamically if you have their names in a string. Like this: `self.send("name")`. – Nelspike Aug 31 '15 at 13:43

1 Answers1

2

There is no built-in one or supplemented one but if you need it you can write one for yourself.

Ember includes "component" helper which allows you to dynamically build component - it's not exactly the same, but might suit your needs.

XLII
  • 1,172
  • 9
  • 18
  • 1
    That's not really part of the answer, but I would advise against having logic in your view (especially dynamically calling other helpers) unless really necessary. – XLII Aug 31 '15 at 12:57
  • The "component" helper is exactly what I was looking for, thank you!I'm trying to generate forms dynamically from a certain content Object, so the component helper will be kind of needed for that. – Nelspike Aug 31 '15 at 14:05