I'm trying to wrap my head around this, but I can't seem to find a clean solution. I got this model:
// models/person.js
export default DS.Model.extend({
birthDate: DS.attr('date'), // e.g. ISO date => 1.2.1990
name: DS.attr('string'), // e.g. John Doe
birthYear: Ember.computed('birthDate', function() {
return this.get('birthDate').getFullYear(); // => 1990
})
});
and I want the persons.hbs to display it like this:
<h4>1990</h4>
<ul>
<li>John Doe</li>
<li>Jane Doe</li>
</ul>
<h4>1989</h4>
<ul>
<li>Jack Doe</li>
</ul>
<h4>1988</h4>
<ul>
<li>Jim Smith</li>
<li>Jack Smith</li>
</ul>
So basically I want the list of all the persons to be separated by each birth year. I'm thankful for any ideas!
Aucun commentaire:
Enregistrer un commentaire