mercredi 12 août 2015

How to compare a property in an instance of a model to something

How would I do the following with Ember

My model is as follows

var model = [
     {name: "a", type="letter"}, 
     {name: "2", type="number"}, 
     {name: "orange", type="fruit"}
]

{{#each item in model}}
        {{#if item.type == "fruit"}}
               <div>The item in this model matches fruit {{item.name}}</div>
        {{/if}}
{{/each}}

How would I display a div with this message ONLY if the model instance type equals fruit?




Aucun commentaire:

Enregistrer un commentaire