I am currently trying to access an associative array inside of an emberjs handlebars file. Accessing through hardcoded values is no problem, but I want to get the element based on a dynamic "index".
The code I have so far is
<Ambientsound @buttonActive= @sound= @updateFunction=/>
and the relevant section of the controller is:
soundPlayers: {"Bells":100,"Fireplace":30}
The code I have above works perfectly fine, but now I am trying to access the soundPlayers.[...] based on the value of sound.id, like so:
<Ambientsound @buttonActive= @sound= @updateFunction=/>
The Value in sound.id is passed as a string and there's nothing I can do about that.
How can I cast sound.id into something that allows me to access the array, or phrase the handlebars query in a way so I can get the result from the array? I could also consider reshaping the array I have in my controller. Anything that helps is welcome!
Aucun commentaire:
Enregistrer un commentaire