dimanche 5 mars 2017

EmberJS filter hasMany data, apply to belongsTo relationship

I have this teams model:

export default DS.Model.extend({
    "name": attr('string'),
    "players": DS.hasMany('player',{
        async: true
    })
});

along with this player model:

export default DS.Model.extend({
    "name":  attr('string'),
    "status": attr('string'),
    "team": DS.belongsTo('team',{
        async: true
    })
});

If I want to list out all the teams, easy enough. And if I want to list out all the teams, and within each team, list out all the players... also simple enough.


    <strong></strong></br>
    <em>Players</em>
    <ul>
    
        <li> - </li>
    
    </ul>


My QUESTION... let us say certain players are injured. If I'm looping through the teams, how would I go about ONLY displaying Teams that have injured players. If at least one player is injured, the TEAM will display, if not... the team will not display?




Aucun commentaire:

Enregistrer un commentaire