lundi 9 novembre 2015

Optimize Ember Handlebars template

Given my failArray as something like;

[
   [ {key: 'some text'}, {value: 'id'} ],
   [ {key: 'some text'}, {value: 'id'} ]
]

Is there a better way to write the below conditional Ember Handlebars template ?

{{#each failArray as |failReasons|}}
        {{#if (eq item.myId failReasons.[0].value)}}
            {{#each failReasons as |reason|}}
                <tr>
                    <td>{{reason.key}}</td>
                </tr>
            {{/each}}
        {{/if}}
    {{/each}}
{{/each}}

Note there is an outer each as well from where I get the "item"




Aucun commentaire:

Enregistrer un commentaire