jeudi 27 août 2015

How to filter in a component?

I want to filter one of the objects being passed into my component, however, the lack of answers when I Google this suggests I am going about solving this particular problem the wrong way, but it's hard to Google for what you're doing wrong :P

My data model looks like this:

App.Browser = DS.Model.extend({
    slug: attr('string'),
    versions: DS.hasMany('version', {async: true})
});

App.Version = DS.Model.extend({
    browser: DS.belongsTo('browser'),
    version: attr('string'),
    status: attr('string')
});

I want to create a component (versions-list) that, when passed a browser's versions will separate the versions into different groups based on their status.

<h1>Beta Versions</h1>
     Version 43.0<br>
     Version 42.0
<h1>Current Version</h1>
     Version 41.0
<h1>Retired Versions</h1>
     Version 40.0
     Version 39.0

What's the best way to go about doing this?




Aucun commentaire:

Enregistrer un commentaire