jeudi 10 mars 2016

Ember Component Properties Pass by Name

I am trying to pass a property into an Ember component. I don't know the name of the property at build time. The name is stored in a variable. How to I evaluate the variable before passing it into the component?

Let's say element.selected = "form.username" (I don't know this at build time). I want:

{{power-select options=element.options selected=element.selected}}

To become:

{{power-select options=element.options selected=form.username}}

I didn't write power-select so I can't change the way it behaves.

FYI I don't know the name of the property at build time because I receive an array of strings and for each element I make a input box (or similar). The values of the input box are stored in form.THE_STRING_FROM_THE_ARRAY. This isn't relevant other than saying there is no way to know the value of element.selected as build time.

Thanks!

Aucun commentaire:

Enregistrer un commentaire