lundi 16 novembre 2015

Ember bind-attr deprecated, how to rewrite using new preferred approach?

I'm an Ember newbie, and am trying to alter the following handlebars/template line of code to not use the deprecated bind-attr approach (NOTE: the code is used to sort a table and show an up/down icon accordingly, and is taken from here: http://ift.tt/1X2zssE; linked to from here: http://ift.tt/1QH6DSJ):

<span {{bind-attr class="sortedOnID:sorted glyphiconDirection :glyphicon"}}></span>

I've found some examples online (e.g., http://ift.tt/1X2zsbX) of how to move away from the deprecated approach, but I can't seem to apply them to this.

I've tried several permutations, but can't figure out how to re-write it to keep the old functionality. E.g., none of the following are working for me:

<span class={{if sortedOnID "sorted glyphiconDirection :glyphicon"}}></span>

<span class={{if sortedOnID "sorted"}} {{if sortedOnID "glyphiconDirection :glyphicon"}}></span>

<span class="{{if sortedOnID "sorted glyphiconDirection :glyphicon"}}"></span>

Can anyone provide some guidance? Thanks!

Aucun commentaire:

Enregistrer un commentaire