mardi 24 février 2015

Only show part of template if there exists at least one child-object

I've got a model like this:



import DS from 'ember-data';

var Post = DS.Model.extend({
title: DS.attr('string'),
downloads: DS.hasMany('download')
});

export default Post;


and would like to show the downloads-section only when there is at least 1 or more downloads in the post.


I tried introducing a computed property in the Controller but can't access the model from there.


What else can I do?





Aucun commentaire:

Enregistrer un commentaire